I am using Jest to test a function in my project, but toHaveBeenCalledWith is missing my second parameter {}:
describe("api.js", () => {
it("should call callback with url", () => {
const mockCallback = jest.fn();
setAppBackend(mockCallback)("/duck");
expect(mockCallback).toHaveBeenCalledWith("https://www.example.org/duck", {});
});
});
● api.js › should call callback with url
expect(jest.fn()).toHaveBeenCalledWith(...expected)
- Expected
+ Received
- "https://www.example.org/duck",
+ "http://www.example.org/duck",
{},
Why is toHaveBeenCalledWith missing {}?