Closed lallenfrancisl closed 2 years ago
The issue is with the way AxiosInstance
interface is defined, in which the interface defines AxiosInstance
itself as method. This causes the type of DeepMockProxy to set this.axios
type as mock instead of the methods inside this.axios
export declare type DeepMockProxy<T> = {
[K in keyof T]: T[K] extends (...args: infer A) => infer B ? CalledWithMock<B, A> : DeepMockProxy<T[K]>;
} & T;
This does not work since the type of
this.axios
is not mock type. But we can domockHttpClient.axios.mockImplementation()
My hypothesis is that it does not work since the AxiosInstance is extended from Axios