mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2024-12-28 11:58:24 +03:00
22 lines
779 B
TypeScript
22 lines
779 B
TypeScript
import { render, screen } from '@testing-library/react';
|
|
import type { ReactNode } from 'react';
|
|
import { ChartCard } from '../../../shlink-web-component/visits/charts/ChartCard';
|
|
|
|
describe('<ChartCard />', () => {
|
|
const setUp = (title: Function | string = '', footer?: ReactNode) => render(
|
|
<ChartCard title={title} footer={footer} />,
|
|
);
|
|
|
|
it.each([
|
|
['the title', 'the title'],
|
|
[() => 'the title from func', 'the title from func'],
|
|
])('properly renders title by parsing provided value', (title, expectedTitle) => {
|
|
setUp(title);
|
|
expect(screen.getByText(expectedTitle)).toBeInTheDocument();
|
|
});
|
|
|
|
it('renders footer only when provided', () => {
|
|
setUp('', 'the footer');
|
|
expect(screen.getByText('the footer')).toBeInTheDocument();
|
|
});
|
|
});
|