Skip to content

Commit 0f4610a

Browse files
fix: missing test added
1 parent 6dfacb9 commit 0f4610a

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

src/authz-module/audit-user/index.test.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff 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(/view all permissions/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

0 commit comments

Comments
 (0)