shlink-web-client/test/visits/charts/DoughnutChart.test.tsx

25 lines
689 B
TypeScript
Raw Normal View History

2022-05-13 21:25:32 +03:00
import { screen } from '@testing-library/react';
import { DoughnutChart } from '../../../src/visits/charts/DoughnutChart';
2022-07-10 20:44:49 +03:00
import { setUpCanvas } from '../../__helpers__/setUpTest';
2021-09-19 11:57:36 +03:00
describe('<DoughnutChart />', () => {
const stats = {
foo: 123,
bar: 456,
};
it('renders Doughnut with expected props', () => {
const { events } = setUpCanvas(<DoughnutChart stats={stats} />);
expect(events).toBeTruthy();
expect(events).toMatchSnapshot();
});
it('renders expected legend', () => {
setUpCanvas(<DoughnutChart stats={stats} />);
expect(screen.getByText('foo')).toBeInTheDocument();
expect(screen.getByText('bar')).toBeInTheDocument();
2022-05-13 21:25:32 +03:00
});
});