1- import { cleanup , fireEvent , render , screen } from '@testing-library/react' ;
1+ import { fireEvent , render , screen } from '@testing-library/react' ;
22import React from 'react' ;
33import { act } from 'react-dom/test-utils' ;
44import { useInView } from 'react-intersection-observer' ;
@@ -26,7 +26,6 @@ describe('AnchorNav Component', () => {
2626 } ) ;
2727
2828 afterEach ( ( ) => {
29- cleanup ( ) ;
3029 history . replaceState ( null , '' , '#' ) ;
3130 jest . clearAllMocks ( ) ;
3231 jest . useRealTimers ( ) ;
@@ -62,7 +61,7 @@ describe('AnchorNav Component', () => {
6261 expect ( section1El ?. scrollIntoView ) . toHaveBeenCalledWith ( { behavior : 'smooth' } ) ;
6362 expect ( replaceStateSpy ) . toHaveBeenCalledWith ( null , '' , '#section1' ) ;
6463 expect ( navLink1 ) . toHaveClass ( 'active' ) ;
65- expect ( navLink1 . getAttribute ( 'aria-current' ) ) . toBe ( 'true' ) ;
64+ expect ( navLink1 ) . toHaveAttribute ( 'aria-current' , 'true' ) ;
6665 } ) ;
6766
6867 it ( 'activates a section based on the observer inView value' , ( ) => {
@@ -80,7 +79,7 @@ describe('AnchorNav Component', () => {
8079 const navLink2 = screen . getByText ( 'Section 2' ) ;
8180
8281 expect ( navLink2 ) . toHaveClass ( 'active' ) ;
83- expect ( navLink2 . getAttribute ( 'aria-current' ) ) . toBe ( 'true' ) ;
82+ expect ( navLink2 ) . toHaveAttribute ( 'aria-current' , 'true' ) ;
8483 } ) ;
8584
8685 it ( 'scrolls to the section corresponding to the initial URL hash on load' , ( ) => {
0 commit comments