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

22 lines
596 B
TypeScript
Raw Normal View History

import { render, screen } from '@testing-library/react';
2023-05-27 12:57:26 +03:00
import { MemoryRouter } from 'react-router';
import { AsideMenu } from '../../src/common/AsideMenu';
2018-08-12 09:49:08 +03:00
describe('<AsideMenu />', () => {
const setUp = () => render(
<MemoryRouter>
2023-08-04 12:16:01 +03:00
<AsideMenu routePrefix="/abc123" />
</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
});
});