I use Jest for testing.
I have a module with functions to call my api. Funcitons in this module uses different function which is also exported. How to mock callApiRequest() and restore it after every test?
export const callApiRequest = () => {};
export const fetchItems = () => callApiRequest();
export const fetchConfig = () => callApiRequest();
When I use jest.spyOn(), tests results shows that it was not called.
Aucun commentaire:
Enregistrer un commentaire