1 import * as useFeatureModule from '@proton/features/useFeature';
2 import type { DeepPartial } from '@proton/shared/lib/interfaces';
4 type HookReturnType = ReturnType<typeof useFeatureModule.default>;
7 * Basic and raw useFeature mock
11 * const mockedUseFeature = mockUseFeature({ feature: { Value: true } });
12 * expect(mockedUseFeature.code).toBe('FeatureCode');
15 * More advanced mocks will be needed in case of components with multiple calls to useFeature
17 export const mockUseFeature = (value?: DeepPartial<ReturnType<typeof useFeatureModule.default>>) => {
18 const mockedUseFeature = jest.spyOn(useFeatureModule, 'default');
20 mockedUseFeature.mockImplementation(
45 return mockedUseFeature;