File tree Expand file tree Collapse file tree
src/authz-module/libraries-manager/ErrorPage Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import {
2- screen , fireEvent , waitFor ,
2+ screen , waitFor ,
33} from '@testing-library/react' ;
4+ import userEvent from '@testing-library/user-event' ;
45import { ErrorBoundary } from 'react-error-boundary' ;
56import { renderWrapper } from '@src/setupTest' ;
67import LibrariesErrorFallback from './index' ;
@@ -67,9 +68,8 @@ describe('LibrariesErrorFallback', () => {
6768 < ThrowError error = { error } />
6869 </ ErrorBoundary > ,
6970 ) ;
70- const reloadBtn = screen . getByText ( / R e l o a d P a g e / i) ;
71- fireEvent . click ( reloadBtn ) ;
72- // If your ErrorPage uses error.refetch, this will be called
73- await waitFor ( ( ) => expect ( refetch ) . toHaveBeenCalled ( ) ) ;
71+ const user = userEvent . setup ( )
72+ await user . click ( screen . getByText ( / R e l o a d P a g e / i) )
73+ expect ( refetch ) . toHaveBeenCalled ( ) ;
7474 } ) ;
7575} ) ;
You can’t perform that action at this time.
0 commit comments