shlink-web-client/test/common/AsideMenu.test.tsx

23 lines
718 B
TypeScript
Raw Normal View History

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