There are multiple axios call in my react component. I am trying to test responses wrt URL. But how to check on URL's.
Below is the code:
import mockAxios from "jest-mock-axios";
// other test cases inside describe
mockAxios.get.mockImplementation((url) => {
console.log("url", url);
switch (url) {
case "//companies/123/activity":
return Promise.resolve({ data: [] });
case "//activity/events":
return Promise.resolve({ data: [] });
case "//companies/123/activity/users":
return Promise.resolve({ data: [] });
default:
return Promise.reject(new Error("not found"));
}
});
But not getting url, the arg is empty.