I am trying to mock an axios module by create this Promise function
// __mocks__/axios.js export default function axios() { return new Promise((resolve) =>
In my tests, I usually just mock axios like this:
import axios from "axios"; jest.mock("axios"); const mockAxios = axios as jest.Mocked;
Then in your describe block:
beforeEach(() => { mockAxios.request.mockImplementationOnce( (): Promise => Promise.resolve({ hello: "world" }) ); });