2022-05-03 19:03:14 +03:00
|
|
|
import { render, screen } from '@testing-library/react';
|
2023-04-13 22:48:29 +03:00
|
|
|
import { fromPartial } from '@total-typescript/shoehorn';
|
2023-05-27 12:57:26 +03:00
|
|
|
import { MemoryRouter } from 'react-router';
|
2023-07-27 23:23:46 +03:00
|
|
|
import { AsideMenu } from '../../shlink-web-component/common/AsideMenu';
|
2022-02-08 00:17:57 +03:00
|
|
|
|
2018-08-12 09:49:08 +03:00
|
|
|
describe('<AsideMenu />', () => {
|
2023-07-15 14:14:49 +03:00
|
|
|
const setUp = () => render(
|
2022-05-03 19:03:14 +03:00
|
|
|
<MemoryRouter>
|
2023-07-15 14:14:49 +03:00
|
|
|
<AsideMenu selectedServer={fromPartial({ id: 'abc123', version: '2.8.0' })} />
|
2022-05-03 19:03:14 +03:00
|
|
|
</MemoryRouter>,
|
|
|
|
);
|
2018-12-18 00:32:51 +03:00
|
|
|
|
2022-12-23 22:42:47 +03:00
|
|
|
it('contains links to different sections', () => {
|
|
|
|
setUp();
|
2018-08-12 09:49:08 +03:00
|
|
|
|
2022-05-03 19:03:14 +03:00
|
|
|
const links = screen.getAllByRole('link');
|
2018-08-12 09:49:08 +03:00
|
|
|
|
2022-05-03 19:03:14 +03:00
|
|
|
expect.assertions(links.length + 1);
|
2023-07-15 14:14:49 +03:00
|
|
|
expect(links).toHaveLength(5);
|
2022-05-03 19:03:14 +03:00
|
|
|
links.forEach((link) => expect(link.getAttribute('href')).toContain('abc123'));
|
2018-08-12 09:49:08 +03:00
|
|
|
});
|
|
|
|
});
|