Skip to content

Commit adc04dd

Browse files
committed
update to use test utils
1 parent 178b905 commit adc04dd

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

client/common/RouterTab.test.tsx

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,18 @@
11
import React from 'react';
2-
import { render, screen } from '@testing-library/react';
3-
import { MemoryRouter } from 'react-router-dom';
2+
import { render, screen } from '../test-utils';
43
import Tab from './RouterTab';
54

65
describe('Tab', () => {
76
it('renders a NavLink with correct text and link', () => {
8-
render(
9-
<MemoryRouter>
10-
<Tab to="/dashboard">Dashboard</Tab>
11-
</MemoryRouter>
12-
);
7+
render(<Tab to="/dashboard">Dashboard</Tab>);
138

149
const linkElement = screen.getByText('Dashboard');
1510
expect(linkElement).toBeInTheDocument();
1611
expect(linkElement.getAttribute('href')).toBe('/dashboard');
1712
});
1813

1914
it('includes the dashboard-header class names', () => {
20-
const { container } = render(
21-
<MemoryRouter>
22-
<Tab to="/settings">Settings</Tab>
23-
</MemoryRouter>
24-
);
15+
const { container } = render(<Tab to="/settings">Settings</Tab>);
2516

2617
const listItem = container.querySelector('li');
2718
const link = container.querySelector('a');

0 commit comments

Comments
 (0)