File tree Expand file tree Collapse file tree
src/authz-module/libraries-manager Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import {
2- screen , fireEvent , waitFor ,
3- } from '@testing-library/react' ;
1+ import { screen } from '@testing-library/react' ;
2+ import userEvent from '@testing-library/user-event' ;
43import { ErrorBoundary } from 'react-error-boundary' ;
54import { renderWrapper } from '@src/setupTest' ;
65import LibrariesErrorFallback from './index' ;
@@ -67,9 +66,8 @@ describe('LibrariesErrorFallback', () => {
6766 < ThrowError error = { error } />
6867 </ ErrorBoundary > ,
6968 ) ;
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 ( ) ) ;
69+ const user = userEvent . setup ( ) ;
70+ await user . click ( screen . getByText ( / R e l o a d P a g e / i) ) ;
71+ expect ( refetch ) . toHaveBeenCalled ( ) ;
7472 } ) ;
7573} ) ;
Original file line number Diff line number Diff line change @@ -6,8 +6,8 @@ import { AppContext } from '@edx/frontend-platform/react';
66import { useValidateUserPermissions } from '@src/data/hooks' ;
77import { usePermissionsByRole } from '@src/authz-module/data/hooks' ;
88import { PermissionMetadata , ResourceMetadata , Role } from 'types' ;
9- import { libraryPermissions , libraryResourceTypes , libraryRolesMetadata } from './constants' ;
109import { CustomErrors } from '@src/constants' ;
10+ import { libraryPermissions , libraryResourceTypes , libraryRolesMetadata } from './constants' ;
1111
1212const LIBRARY_TEAM_PERMISSIONS = [ 'view_library_team' , 'manage_library_team' ] ;
1313
You can’t perform that action at this time.
0 commit comments