mirror of
https://github.com/shlinkio/shlink-web-client.git
synced 2026-08-01 16:41:53 +00:00
Move shlink-web-component tests to their own folder
This commit is contained in:
22
shlink-web-component/test/visits/charts/ChartCard.test.tsx
Normal file
22
shlink-web-component/test/visits/charts/ChartCard.test.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import type { ReactNode } from 'react';
|
||||
import { ChartCard } from '../../../src/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();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user