@@ -2,9 +2,8 @@ import React from 'react';
22import { screen } from '@testing-library/react' ;
33import { useAllRoleAssignments , useOrgs , useScopes } from '@src/authz-module/data/hooks' ;
44import { ToastManagerProvider } from '@src/authz-module/libraries-manager/ToastManagerContext' ;
5- import { renderWithAllProviders , renderWrapper } from '@src/setupTest' ;
5+ import { renderWithAllProviders } from '@src/setupTest' ;
66import userEvent from '@testing-library/user-event' ;
7- import { useNavigate } from 'react-router-dom' ;
87import AuthzHome from './index' ;
98import messages from './messages' ;
109
@@ -29,33 +28,6 @@ const renderAuthzHome = () => renderWithAllProviders(
2928 </ ToastManagerProvider > ,
3029) ;
3130
32- jest . mock ( '../components/AuthZLayout' , ( ) => function MockAuthZLayout (
33- { children, actions } : { children : React . ReactNode ; actions ?: React . ReactNode [ ] } ,
34- ) {
35- return < div data-testid = "authz-layout" > { actions } { children } </ div > ;
36- } ) ;
37-
38- jest . mock ( '../roles-permissions/RolesPermissions' , ( ) => function MockRolesPermissions ( ) {
39- return < div data-testid = "roles-permissions" > Roles & Permissions Content </ div > ;
40- } ) ;
41-
42- jest . mock ( '@openedx/paragon' , ( ) => ( {
43- Tab : ( { children, title } : { children : React . ReactNode , title : string } ) => < div data-testid = "tab" role = "tabpanel" > { title } : { children } </ div > ,
44- Tabs : ( { children } : { children : React . ReactNode } ) => < div data-testid = "tabs" > { children } </ div > ,
45- Button : ( { children, onClick } : React . PropsWithChildren < { onClick ?: ( ) => void } > ) => (
46- < button type = "button" onClick = { onClick } > { children } </ button >
47- ) ,
48- Icon : ( ) => null ,
49- } ) ) ;
50-
51- jest . mock ( 'react-router-dom' , ( ) => ( {
52- ...jest . requireActual ( 'react-router-dom' ) ,
53- useNavigate : jest . fn ( ) ,
54- } ) ) ;
55-
56- const mockNavigate = jest . fn ( ) ;
57- ( useNavigate as jest . Mock ) . mockReturnValue ( mockNavigate ) ;
58-
5931describe ( 'AuthzHome' , ( ) => {
6032 beforeEach ( ( ) => {
6133 ( useAllRoleAssignments as jest . Mock ) . mockReturnValue ( emptyResponse ) ;
@@ -99,11 +71,4 @@ describe('AuthzHome', () => {
9971 expect ( screen . getAllByText ( 'Role' ) . length ) . toBe ( 2 ) ; // Header and role filter;
10072 expect ( screen . getByText ( 'Actions' ) ) . toBeInTheDocument ( ) ;
10173 } ) ;
102-
103- it ( 'navigates to the wizard when the Assign Role button is clicked' , async ( ) => {
104- const user = userEvent . setup ( ) ;
105- renderWrapper ( < AuthzHome /> ) ;
106- await user . click ( screen . getByRole ( 'button' , { name : / A s s i g n R o l e / i } ) ) ;
107- expect ( mockNavigate ) . toHaveBeenCalled ( ) ;
108- } ) ;
10974} ) ;
0 commit comments