diff --git a/package.json b/package.json index 792e0b1..55fb71b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@decathlon/moon-testing", - "version": "0.0.2", + "version": "0.1.0", "description": "Moon testing utilities.", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/src/index.ts b/src/index.ts index a624646..dbf69eb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -36,16 +36,16 @@ export class AxiosClient { } export function mockAxiosClientConstructor(ClientFactory = AxiosClient): void { - Axios.create = jest.fn().mockImplementation(({ baseUrl }) => { + Axios.create = ({ baseUrl }) => { return new ClientFactory(baseUrl); - }); + }; } mockAxiosClientConstructor(AxiosClient); export const cancelToken = { cancel: () => jest.fn() }; -StaticAxios.CancelToken.source = jest.fn().mockReturnValue(cancelToken); +StaticAxios.CancelToken.source = () => cancelToken; export { default as MoonClient } from "./moon-client"; export * from "./moon-client";