Skip to content

Commit 1accc48

Browse files
committed
squash!: Fix existing tests
1 parent ccd9827 commit 1accc48

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/testUtils.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ import {
2626
import { ToastContext, type ToastContextData } from './generic/toast-context';
2727
import initializeReduxStore, { type DeprecatedReduxState } from './store';
2828
import { getApiWaffleFlagsUrl } from './data/api';
29+
import { CONTENT_LIBRARY_PERMISSIONS } from './authz/constants';
30+
import * as authzApi from '@src/authz/data/api';
31+
2932

3033
/** @deprecated Use React Query and/or regular React Context instead of redux */
3134
let reduxStore: Store;
@@ -192,6 +195,14 @@ export function initializeMocks({ user = defaultUser, initialState = undefined }
192195
// Clear the call counts etc. of all mocks. This doesn't remove the mock's effects; just clears their history.
193196
jest.clearAllMocks();
194197

198+
// Mock user permissions to avoid breaking tests that monitor axios calls
199+
jest.spyOn(authzApi, 'validateUserPermissions').mockResolvedValue([
200+
{
201+
action: CONTENT_LIBRARY_PERMISSIONS.PUBLISH_LIBRARY_CONTENT,
202+
allowed: true,
203+
},
204+
]);
205+
195206
return {
196207
reduxStore,
197208
axiosMock,

0 commit comments

Comments
 (0)