Jest has a function expect.any
to match an instance of the object.
const mock = jest.fn();
class MyObject {}
mock(new MyObject());
expect(mock).toHaveBeenCalledWith(expect.any(MyObject));
Jest has a function expect.any
to match an instance of the object.
const mock = jest.fn();
class MyObject {}
mock(new MyObject());
expect(mock).toHaveBeenCalledWith(expect.any(MyObject));