'Jest toHaveBeenCalledWith is missing the second parameter

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 {}?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source