79235996

Date: 2024-11-29 06:13:25
Score: 0.5
Natty:
Report link

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(...)

...
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: kena0ki