Skip to content

Commit 4ac83a8

Browse files
committed
feat: simplify AssignRoleWizardPage tests by removing scope handling and updating navigation path
1 parent dbf60c8 commit 4ac83a8

1 file changed

Lines changed: 5 additions & 11 deletions

File tree

src/authz-module/wizard/AssignRoleWizardPage.test.tsx

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ jest.mock('../data/hooks', () => ({
1616

1717
jest.mock('./AssignRoleWizard', () => ({
1818
__esModule: true,
19-
default: ({ scope, initialUsers, onClose }: { scope: string; initialUsers?: string; onClose: () => void }) => (
20-
<div data-testid="assign-role-wizard" data-scope={scope} data-users={initialUsers}>
19+
default: ({ initialUsers, onClose }: { initialUsers?: string; onClose: () => void }) => (
20+
<div data-testid="assign-role-wizard" data-users={initialUsers}>
2121
<button type="button" data-testid="wizard-close" onClick={onClose}>Close</button>
2222
Assign Role Wizard
2323
</div>
@@ -54,18 +54,12 @@ describe('AssignRoleWizardPage', () => {
5454
jest.clearAllMocks();
5555
});
5656

57-
it('renders the wizard when scope and library are present', () => {
57+
it('renders the wizard when library is present', () => {
5858
setupMocks();
5959
renderWrapper(<AssignRoleWizardPage />);
6060
expect(screen.getByTestId('assign-role-wizard')).toBeInTheDocument();
6161
});
6262

63-
it('passes scope to the wizard', () => {
64-
setupMocks({ scope: 'lib:456' });
65-
renderWrapper(<AssignRoleWizardPage />);
66-
expect(screen.getByTestId('assign-role-wizard')).toHaveAttribute('data-scope', 'lib:456');
67-
});
68-
6963
it('passes initialUsers from search params to the wizard', () => {
7064
setupMocks({ users: 'alice,bob' });
7165
renderWrapper(<AssignRoleWizardPage />);
@@ -78,7 +72,7 @@ describe('AssignRoleWizardPage', () => {
7872
expect(screen.getByRole('heading', { name: 'Assign Role' })).toBeInTheDocument();
7973
});
8074

81-
it('navigates to team members path when wizard onClose is triggered', async () => {
75+
it('navigates to home path when wizard onClose is triggered', async () => {
8276
setupMocks();
8377
const mockNavigate = jest.fn();
8478
const { useNavigate } = jest.requireMock('react-router-dom');
@@ -88,6 +82,6 @@ describe('AssignRoleWizardPage', () => {
8882
renderWrapper(<AssignRoleWizardPage />);
8983
await user.click(screen.getByTestId('wizard-close'));
9084

91-
expect(mockNavigate).toHaveBeenCalledWith('/authz/libraries/lib:123');
85+
expect(mockNavigate).toHaveBeenCalledWith('/authz');
9286
});
9387
});

0 commit comments

Comments
 (0)