File tree Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change 1
1
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' ;
4
3
import Tab from './RouterTab' ;
5
4
6
5
describe ( 'Tab' , ( ) => {
7
6
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 > ) ;
13
8
14
9
const linkElement = screen . getByText ( 'Dashboard' ) ;
15
10
expect ( linkElement ) . toBeInTheDocument ( ) ;
16
11
expect ( linkElement . getAttribute ( 'href' ) ) . toBe ( '/dashboard' ) ;
17
12
} ) ;
18
13
19
14
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 > ) ;
25
16
26
17
const listItem = container . querySelector ( 'li' ) ;
27
18
const link = container . querySelector ( 'a' ) ;
You can’t perform that action at this time.
0 commit comments