Skip to content

Commit 4f1b3f1

Browse files
committed
test ts-check
1 parent c7a090d commit 4f1b3f1

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

src/frontend/src/tests/pages/ChangeRequestDetailPage/ChangeRequestDetails.test.tsx

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,16 @@ import {
1010
exampleActivationChangeRequest as exActivationCR,
1111
exampleStandardChangeRequest as exStandardCR
1212
} from '../../test-support/test-data/change-requests.stub';
13-
import {
14-
exampleAdminUser,
15-
exampleAdminUser2,
16-
exampleGuestUser,
17-
exampleMemberUser
18-
} from '../../test-support/test-data/users.stub';
1913
import { render, screen, routerWrapperBuilder, fireEvent } from '../../test-support/test-utils';
2014
import { mockUseQueryResult, mockAuth } from '../../test-support/test-data/test-utils.stub';
2115
import { useSingleChangeRequest } from '../../../hooks/change-requests.hooks';
2216
import { useAuth } from '../../../hooks/auth.hooks';
2317
import ChangeRequestDetails from '../../../pages/ChangeRequestDetailPage/ChangeRequestDetails';
18+
import {
19+
exampleAuthenticatedAdminUser,
20+
exampleAuthenticatedGuestUser,
21+
exampleAuthenticatedMemberUser
22+
} from '../../test-support/test-data/authenticated-user.stub';
2423

2524
vi.mock('../../../hooks/change-requests.hooks');
2625

@@ -34,7 +33,7 @@ vi.mock('../../../hooks/auth.hooks');
3433

3534
const mockedUseAuth = useAuth as jest.Mock<Auth>;
3635

37-
const mockAuthHook = (user = exampleAdminUser) => {
36+
const mockAuthHook = (user = exampleAuthenticatedAdminUser) => {
3837
mockedUseAuth.mockReturnValue(mockAuth(false, user));
3938
};
4039

@@ -62,39 +61,39 @@ describe.skip('change request details container', () => {
6261

6362
it('enables review if the user is an admin', () => {
6463
mockSingleCRHook(false, false, exActivationCR);
65-
mockAuthHook(exampleAdminUser2);
64+
mockAuthHook(exampleAuthenticatedAdminUser);
6665
renderComponent();
6766

6867
expect(screen.getByText('Review')).not.toHaveAttribute('aria-disabled');
6968
});
7069

7170
it("disables review of admin's own change requests", () => {
7271
mockSingleCRHook(false, false, exActivationCR);
73-
mockAuthHook(exampleAdminUser);
72+
mockAuthHook(exampleAuthenticatedAdminUser);
7473
renderComponent();
7574

7675
expect(screen.getByText('Review')).toHaveAttribute('aria-disabled');
7776
});
7877

7978
it('disables reviewing change requests for guests', () => {
8079
mockSingleCRHook(false, false, exActivationCR);
81-
mockAuthHook(exampleGuestUser);
80+
mockAuthHook(exampleAuthenticatedGuestUser);
8281
renderComponent();
8382

8483
expect(screen.getByText('Review')).toHaveAttribute('aria-disabled');
8584
});
8685

8786
it('disables reviewing change requests for member users', () => {
8887
mockSingleCRHook(false, false, exActivationCR);
89-
mockAuthHook(exampleMemberUser);
88+
mockAuthHook(exampleAuthenticatedMemberUser);
9089
renderComponent();
9190

9291
expect(screen.getByText('Review')).toHaveAttribute('aria-disabled');
9392
});
9493

9594
it('enables implementing if the user is an admin', () => {
9695
mockSingleCRHook(false, false, exStandardCR);
97-
mockAuthHook(exampleAdminUser);
96+
mockAuthHook(exampleAuthenticatedAdminUser);
9897
renderComponent();
9998

10099
fireEvent.click(screen.getByText('Implement Change Request'));
@@ -104,7 +103,7 @@ describe.skip('change request details container', () => {
104103

105104
it('disables implementing change requests for guests', () => {
106105
mockSingleCRHook(false, false, exStandardCR);
107-
mockAuthHook(exampleGuestUser);
106+
mockAuthHook(exampleAuthenticatedGuestUser);
108107
renderComponent();
109108

110109
fireEvent.click(screen.getByText('Implement Change Request'));

src/frontend/src/tests/pages/ChangeRequestDetailPage/ChangeRequestDetailsView.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
mockLogUserInDevReturnValue,
2323
mockGetCurrentUserValue
2424
} from '../../test-support/mock-hooks';
25+
import { exampleAuthenticatedAdminUser } from '../../test-support/test-data/authenticated-user.stub';
2526

2627
vi.mock('../../../hooks/projects.hooks');
2728
vi.mock('../../../hooks/users.hooks');
@@ -72,7 +73,7 @@ describe('Implement change request permission tests', () => {
7273
onboardedTeamTypeIds: [],
7374
onboardingTeamTypeIds: []
7475
});
75-
vi.spyOn(authHooks, 'useAuth').mockReturnValue(mockAuth(false, exampleAdminUser));
76+
vi.spyOn(authHooks, 'useAuth').mockReturnValue(mockAuth(false, exampleAuthenticatedAdminUser));
7677
vi.spyOn(userHooks, 'useGetCurrentUser').mockReturnValue(mockGetCurrentUserValue);
7778
});
7879

0 commit comments

Comments
 (0)