1 import * as useSelectorModule from 'react-redux';
3 // A simple workaround for jest issue not solved yet
4 // https://stackoverflow.com/questions/67872622/jest-spyon-not-working-on-index-file-cannot-redefine-property
5 jest.mock('react-redux', () => {
8 ...jest.requireActual('react-redux'),
12 export const mockUseSelector = (value?: Partial<ReturnType<typeof useSelectorModule.useSelector>>) => {
13 const mockedUseSelector = jest.spyOn(useSelectorModule, 'useSelector');
14 mockedUseSelector.mockReturnValue(value);
15 return mockedUseSelector;