2022-06-11 18:38:12 +03:00
|
|
|
import { render, screen } from '@testing-library/react';
|
2023-07-16 09:47:10 +03:00
|
|
|
import { MapModal } from '../../../src/shlink-web-component/visits/helpers/MapModal';
|
|
|
|
import type { CityStats } from '../../../src/shlink-web-component/visits/types';
|
2019-01-09 22:11:22 +03:00
|
|
|
|
|
|
|
describe('<MapModal />', () => {
|
2023-05-27 12:57:26 +03:00
|
|
|
const toggle = vi.fn();
|
2019-01-09 22:11:22 +03:00
|
|
|
const zaragozaLat = 41.6563497;
|
|
|
|
const zaragozaLong = -0.876566;
|
|
|
|
const newYorkLat = 40.730610;
|
|
|
|
const newYorkLong = -73.935242;
|
2020-09-02 21:13:31 +03:00
|
|
|
const locations: CityStats[] = [
|
2019-01-09 22:11:22 +03:00
|
|
|
{
|
|
|
|
cityName: 'Zaragoza',
|
|
|
|
count: 54,
|
2022-03-26 14:17:42 +03:00
|
|
|
latLong: [zaragozaLat, zaragozaLong],
|
2019-01-09 22:11:22 +03:00
|
|
|
},
|
|
|
|
{
|
|
|
|
cityName: 'New York',
|
|
|
|
count: 7,
|
2022-03-26 14:17:42 +03:00
|
|
|
latLong: [newYorkLat, newYorkLong],
|
2019-01-09 22:11:22 +03:00
|
|
|
},
|
|
|
|
];
|
|
|
|
|
2022-06-11 18:38:12 +03:00
|
|
|
it('renders expected map', () => {
|
|
|
|
render(<MapModal toggle={toggle} isOpen title="Foobar" locations={locations} />);
|
|
|
|
expect(screen.getByRole('dialog')).toMatchSnapshot();
|
2019-01-09 22:11:22 +03:00
|
|
|
});
|
|
|
|
});
|