shlink-web-client/test/visits/charts/HorizontalBarChart.test.tsx
2023-08-03 09:13:10 +02:00

18 lines
804 B
TypeScript

import type { HorizontalBarChartProps } from '../../../shlink-web-component/visits/charts/HorizontalBarChart';
import { HorizontalBarChart } from '../../../shlink-web-component/visits/charts/HorizontalBarChart';
import { setUpCanvas } from '../../__helpers__/setUpTest';
describe('<HorizontalBarChart />', () => {
const setUp = (props: HorizontalBarChartProps) => setUpCanvas(<HorizontalBarChart {...props} />);
it.each([
[{ foo: 123, bar: 456 }, undefined],
[{ one: 999, two: 131313 }, { one: 30, two: 100 }],
[{ one: 999, two: 131313, max: 3 }, { one: 30, two: 100 }],
])('renders chart with expected canvas', (stats, highlightedStats) => {
const { events } = setUp({ stats, highlightedStats });
expect(events).toBeTruthy();
expect(events).toMatchSnapshot();
});
});