@@ -66,10 +66,12 @@ const mockInvalidMultiplePermissions = [
6666
6767describe ( 'useUserPermissions' , ( ) => {
6868 beforeEach ( ( ) => {
69+ // TODO: convert this test to use `initializeMocks()` / `testUtils.tsx`
6970 jest . clearAllMocks ( ) ;
7071 } ) ;
7172
7273 it ( 'returns allowed true when permission is valid' , async ( ) => {
74+ // @ts -ignore since `getAuthenticatedHttpClient` is mocked.
7375 getAuthenticatedHttpClient . mockReturnValue ( {
7476 post : jest . fn ( ) . mockResolvedValueOnce ( { data : mockValidSinglePermission } ) ,
7577 } ) ;
@@ -86,6 +88,7 @@ describe('useUserPermissions', () => {
8688 } ) ;
8789
8890 it ( 'returns allowed false when permission is invalid' , async ( ) => {
91+ // @ts -ignore since `getAuthenticatedHttpClient` is mocked.
8992 getAuthenticatedHttpClient . mockReturnValue ( {
9093 post : jest . fn ( ) . mockResolvedValue ( { data : mockInvalidSinglePermission } ) ,
9194 } ) ;
@@ -101,6 +104,7 @@ describe('useUserPermissions', () => {
101104 } ) ;
102105
103106 it ( 'returns allowed true when multiple permissions are valid' , async ( ) => {
107+ // @ts -ignore since `getAuthenticatedHttpClient` is mocked.
104108 getAuthenticatedHttpClient . mockReturnValue ( {
105109 post : jest . fn ( ) . mockResolvedValueOnce ( { data : mockValidMultiplePermissions } ) ,
106110 } ) ;
@@ -118,6 +122,7 @@ describe('useUserPermissions', () => {
118122 } ) ;
119123
120124 it ( 'returns allowed false when multiple permissions are invalid' , async ( ) => {
125+ // @ts -ignore since `getAuthenticatedHttpClient` is mocked.
121126 getAuthenticatedHttpClient . mockReturnValue ( {
122127 post : jest . fn ( ) . mockResolvedValue ( { data : mockInvalidMultiplePermissions } ) ,
123128 } ) ;
@@ -134,6 +139,7 @@ describe('useUserPermissions', () => {
134139 } ) ;
135140
136141 it ( 'returns allowed false when the permission is not included in the server response' , async ( ) => {
142+ // @ts -ignore since `getAuthenticatedHttpClient` is mocked.
137143 getAuthenticatedHttpClient . mockReturnValue ( {
138144 post : jest . fn ( ) . mockResolvedValue ( { data : mockEmptyPermissions } ) ,
139145 } ) ;
@@ -151,6 +157,7 @@ describe('useUserPermissions', () => {
151157 it ( 'handles error when the API call fails' , async ( ) => {
152158 const mockError = new Error ( 'API Error' ) ;
153159
160+ // @ts -ignore since `getAuthenticatedHttpClient` is mocked.
154161 getAuthenticatedHttpClient . mockReturnValue ( {
155162 post : jest . fn ( ) . mockRejectedValue ( new Error ( 'API Error' ) ) ,
156163 } ) ;
0 commit comments