shlink-web-client/shlink-web-component/test/visits/helpers/MapModal.test.tsx

29 lines
809 B
TypeScript
Raw Normal View History

import { render, screen } from '@testing-library/react';
import { MapModal } from '../../../src/visits/helpers/MapModal';
import type { CityStats } from '../../../src/visits/types';
describe('<MapModal />', () => {
2023-05-27 12:57:26 +03:00
const toggle = vi.fn();
const zaragozaLat = 41.6563497;
const zaragozaLong = -0.876566;
const newYorkLat = 40.730610;
const newYorkLong = -73.935242;
const locations: CityStats[] = [
{
cityName: 'Zaragoza',
count: 54,
2022-03-26 14:17:42 +03:00
latLong: [zaragozaLat, zaragozaLong],
},
{
cityName: 'New York',
count: 7,
2022-03-26 14:17:42 +03:00
latLong: [newYorkLat, newYorkLong],
},
];
it('renders expected map', () => {
render(<MapModal toggle={toggle} isOpen title="Foobar" locations={locations} />);
expect(screen.getByRole('dialog')).toMatchSnapshot();
});
});