The definitions of equivalent functions are not equal. In this way,
function() { return 'blah'; } == function() { return 'blah'; }
toHaveBeenCalledWith() Jasmine, , spied object. , (, , ), toHaveBeenCalledWith()? .
Jasmine, , , . :
describe("A spy example", function() {
var baz = {
foo: 'bar',
thing: [1,2,3],
etc: function() { }
};
beforeEach(function() {
spyOn(baz, 'etc');
baz.etc(baz);
});
it("succeeds", function() {
expect(baz.etc).toHaveBeenCalledWith(baz);
});
it("fails", function() {
expect(baz.etc).toHaveBeenCalledWith({
foo: 'bar',
thing: [1,2,3],
etc: function() { }
});
});
});