@@ -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' ;
1913import { render , screen , routerWrapperBuilder , fireEvent } from '../../test-support/test-utils' ;
2014import { mockUseQueryResult , mockAuth } from '../../test-support/test-data/test-utils.stub' ;
2115import { useSingleChangeRequest } from '../../../hooks/change-requests.hooks' ;
2216import { useAuth } from '../../../hooks/auth.hooks' ;
2317import ChangeRequestDetails from '../../../pages/ChangeRequestDetailPage/ChangeRequestDetails' ;
18+ import {
19+ exampleAuthenticatedAdminUser ,
20+ exampleAuthenticatedGuestUser ,
21+ exampleAuthenticatedMemberUser
22+ } from '../../test-support/test-data/authenticated-user.stub' ;
2423
2524vi . mock ( '../../../hooks/change-requests.hooks' ) ;
2625
@@ -34,7 +33,7 @@ vi.mock('../../../hooks/auth.hooks');
3433
3534const 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' ) ) ;
0 commit comments