1-
2- import { render , screen } from '@testing-library/react' ;
3- import { NavEntry , TextContentEntry } from '../NavEntry' ;
1+ import { render , screen } from '@testing-library/react'
2+ import { NavEntry , TextContentEntry } from '../NavEntry'
43
54const mockEntry : TextContentEntry = {
65 id : 'entry1' ,
76 data : { id : 'Entry1' , section : 'section1' } ,
8- collection : 'textContent' ,
9- } ;
7+ }
108
119describe ( 'NavEntry' , ( ) => {
1210 it ( 'renders without crashing' , ( ) => {
13- render ( < NavEntry entry = { mockEntry } isActive = { false } /> ) ;
14- expect ( screen . getByText ( 'Entry1' ) ) . toBeInTheDocument ( ) ;
15- } ) ;
11+ render ( < NavEntry entry = { mockEntry } isActive = { false } /> )
12+ expect ( screen . getByText ( 'Entry1' ) ) . toBeInTheDocument ( )
13+ } )
1614
1715 it ( 'renders the correct link' , ( ) => {
18- render ( < NavEntry entry = { mockEntry } isActive = { false } /> ) ;
19- expect ( screen . getByRole ( 'link' ) ) . toHaveAttribute ( 'href' , '/section1/entry1' ) ;
20- } ) ;
16+ render ( < NavEntry entry = { mockEntry } isActive = { false } /> )
17+ expect ( screen . getByRole ( 'link' ) ) . toHaveAttribute ( 'href' , '/section1/entry1' )
18+ } )
2119
2220 it ( 'marks the entry as active if isActive is true' , ( ) => {
23- render ( < NavEntry entry = { mockEntry } isActive = { true } /> ) ;
24- expect ( screen . getByRole ( 'link' ) ) . toHaveClass ( 'pf-m-current' ) ;
25- } ) ;
21+ render ( < NavEntry entry = { mockEntry } isActive = { true } /> )
22+ expect ( screen . getByRole ( 'link' ) ) . toHaveClass ( 'pf-m-current' )
23+ } )
2624
2725 it ( 'does not mark the entry as active if isActive is false' , ( ) => {
28- render ( < NavEntry entry = { mockEntry } isActive = { false } /> ) ;
29- expect ( screen . getByRole ( 'link' ) ) . not . toHaveClass ( 'pf-m-current' ) ;
30- } ) ;
26+ render ( < NavEntry entry = { mockEntry } isActive = { false } /> )
27+ expect ( screen . getByRole ( 'link' ) ) . not . toHaveClass ( 'pf-m-current' )
28+ } )
3129
3230 it ( 'matches snapshot' , ( ) => {
33- const { asFragment } = render ( < NavEntry entry = { mockEntry } isActive = { false } /> ) ;
34- expect ( asFragment ( ) ) . toMatchSnapshot ( ) ;
35- } ) ;
36- } ) ;
31+ const { asFragment } = render (
32+ < NavEntry entry = { mockEntry } isActive = { false } /> ,
33+ )
34+ expect ( asFragment ( ) ) . toMatchSnapshot ( )
35+ } )
36+ } )
0 commit comments