shlink-web-client/test/visits/charts/DoughnutChart.test.tsx
2022-07-09 23:03:21 +02:00

24 lines
687 B
TypeScript

import { screen } from '@testing-library/react';
import { DoughnutChart } from '../../../src/visits/charts/DoughnutChart';
import { setUpCanvas } from '../../__mocks__/setUpTest';
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();
});
});