I'm trying something like this:
const useSelector = jest.fn();jest.mock('react-redux', () => ({ useSelector,}));
Then trying to do something like this:
useSelector.mockReturnValueOnce({});shallow(<ComponentUsingUseSelector />);
That will give me an error:
The module factory of
jest.mock()
is not allowed to reference any out-of-scope variables.
So if I can't use an out of scope variable for a mock then how would I return a different value for every test?