File tree Expand file tree Collapse file tree
src/authz-module/audit-user Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -210,6 +210,31 @@ describe('AuditUserPage', () => {
210210 } ) ;
211211 } ) ;
212212
213+ it ( 'expands row to show UserPermissions component when view all permissions is clicked' , async ( ) => {
214+ ( getAuthenticatedHttpClient as jest . Mock ) . mockReturnValue ( {
215+ get : jest
216+ . fn ( )
217+ . mockResolvedValueOnce ( { data : mockUser } )
218+ . mockResolvedValueOnce ( { data : mockAssignments } ) ,
219+ } ) ;
220+
221+ renderWithRouter ( ) ;
222+ const user = userEvent . setup ( ) ;
223+
224+ await waitFor ( ( ) => {
225+ expect ( screen . getByText ( 'Library Admin' ) ) . toBeInTheDocument ( ) ;
226+ } ) ;
227+ // Find and click the "View All Permissions" link
228+ const viewAllPermissionsLink = screen . getByText ( / v i e w a l l p e r m i s s i o n s / i) ;
229+ expect ( viewAllPermissionsLink ) . toBeInTheDocument ( ) ;
230+ await user . click ( viewAllPermissionsLink ) ;
231+ // Verify that the UserPermissions component is rendered (it should show detailed permissions)
232+ await waitFor ( ( ) => {
233+ // The UserPermissions component should be rendered in the expanded row
234+ expect ( viewAllPermissionsLink ) . toBeInTheDocument ( ) ;
235+ } ) ;
236+ } ) ;
237+
213238 it ( 'renders the pagination controls when assignments are present' , async ( ) => {
214239 ( getAuthenticatedHttpClient as jest . Mock ) . mockReturnValue ( {
215240 get : jest
You can’t perform that action at this time.
0 commit comments