I\'m trying to use the following mock:
const mockLogger = jest.fn();
jest.mock(\"./myLoggerFactory\", () => (type) => mockLogger);
but m
I want to improve last answer with an example of code working:
import { getCookie, setCookie } from '../../utilities/cookies';
jest.mock('../../utilities/cookies', () => ({
getCookie: jest.fn(),
setCookie: jest.fn(),
}));
// Describe(''...)
it('should do something', () => {
const instance = shallow( ).instance();
getCookie.mockReturnValue('showMoreInfoTooltip');
instance.callSomeFunc();
expect(getCookie).toHaveBeenCalled();
});