Skip to content

Commit 30c5653

Browse files
committed
Mock shouldDisplayFeature
1 parent b9e8160 commit 30c5653

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

frontend/dashboard/app/App.test.tsx

+6-5
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,15 @@ import type { QueryClient } from '@tanstack/react-query';
1212
import userEvent from '@testing-library/user-event';
1313
import type { Organization } from 'app-shared/types/Organization';
1414
import { APP_DASHBOARD_BASENAME } from 'app-shared/constants';
15-
import { typedLocalStorage } from '@studio/pure-functions';
1615
import { FeatureFlag } from 'app-shared/utils/featureToggleUtils';
1716

1817
jest.mock('react-router-dom', () => jest.requireActual('react-router-dom')); // Todo: Remove this when we have removed the global mock: https://github.com/Altinn/altinn-studio/issues/14597
1918

19+
jest.mock('app-shared/utils/featureToggleUtils', () => ({
20+
...jest.requireActual('app-shared/utils/featureToggleUtils'),
21+
shouldDisplayFeature: jest.fn().mockImplementation((flag) => flag === FeatureFlag.OrgLibrary),
22+
}));
23+
2024
// Test data:
2125
const org: Organization = {
2226
avatar_url: 'data:image/svg+xml;utf8,<svg></svg>',
@@ -25,10 +29,7 @@ const org: Organization = {
2529
};
2630

2731
describe('App', () => {
28-
beforeEach(() => {
29-
jest.clearAllMocks();
30-
typedLocalStorage.setItem('featureFlags', [FeatureFlag.OrgLibrary]);
31-
});
32+
beforeEach(jest.clearAllMocks);
3233

3334
it('should display spinner while loading', () => {
3435
renderApp();

0 commit comments

Comments
 (0)