jasmine toHaveBeenCalledWith partial matching

Solution 1:

Try

toHaveBeenCalledWith(jasmine.any(Object), jasmine.any(Function))

Solution 2:

Jasmine 2:

 expect(callback).toHaveBeenCalledWith(jasmine.objectContaining({
    bar: "baz"
  }));

https://jasmine.github.io/2.0/introduction.html

Solution 3:

If you wish to test for specific things, you can do something like:

expect(mockSomething.someMethod.mostRecentCall.args[0].pool.maxSockets).toEqual(50);

The syntax in Jasmine 2 is now:

mockSomething.someMethod.calls.mostRecent().args[0]