2023-07-24 21:14:59 +03:00
|
|
|
import type { HorizontalBarChartProps } from '../../../shlink-web-component/visits/charts/HorizontalBarChart';
|
|
|
|
import { HorizontalBarChart } from '../../../shlink-web-component/visits/charts/HorizontalBarChart';
|
2022-07-10 20:44:49 +03:00
|
|
|
import { setUpCanvas } from '../../__helpers__/setUpTest';
|
2018-09-08 10:06:18 +03:00
|
|
|
|
2021-09-19 11:57:36 +03:00
|
|
|
describe('<HorizontalBarChart />', () => {
|
2022-05-13 21:18:40 +03:00
|
|
|
const setUp = (props: HorizontalBarChartProps) => setUpCanvas(<HorizontalBarChart {...props} />);
|
2018-09-08 10:06:18 +03:00
|
|
|
|
2020-04-09 10:44:14 +03:00
|
|
|
it.each([
|
2022-05-06 20:46:47 +03:00
|
|
|
[{ 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) => {
|
2022-05-13 21:18:40 +03:00
|
|
|
const { events } = setUp({ stats, highlightedStats });
|
2022-05-06 20:46:47 +03:00
|
|
|
|
|
|
|
expect(events).toBeTruthy();
|
|
|
|
expect(events).toMatchSnapshot();
|
2020-04-09 10:44:14 +03:00
|
|
|
});
|
2018-09-08 10:06:18 +03:00
|
|
|
});
|