If you can export the object axios.create
returns and use it in your project instead of using axios
directly, then you can simply use vi.spyOn
.
src file
...
export const api = axios.create(...);
...
test file
...
vi.spyOn(api, 'get').mockResolvedValue(...)
...