shlink-web-client/shlink-web-component/test/common/AsideMenu.test.tsx
2023-08-03 09:13:11 +02:00

22 lines
697 B
TypeScript

import { render, screen } from '@testing-library/react';
import { fromPartial } from '@total-typescript/shoehorn';
import { MemoryRouter } from 'react-router';
import { AsideMenu } from '../../src/common/AsideMenu';
describe('<AsideMenu />', () => {
const setUp = () => render(
<MemoryRouter>
<AsideMenu selectedServer={fromPartial({ id: 'abc123', version: '2.8.0' })} />
</MemoryRouter>,
);
it('contains links to different sections', () => {
setUp();
const links = screen.getAllByRole('link');
expect.assertions(links.length + 1);
expect(links).toHaveLength(5);
links.forEach((link) => expect(link.getAttribute('href')).toContain('abc123'));
});
});