javascript - Jasmine spy expects to be called with "Object(...)" -


i completing migration jasmine 1.3 2.0. far have refactored of code comply 2.0's newer syntax. however, kind of tests still failing.

in short, test looks this:

var obj = new customcriteria();  spyon(my, "function"); my.function(obj); expect(my.function).tohavebeencalledwith({ big: "fat object" }); 

my customcriteria class:

var customcriteria = function() {     this.big = "fat object"; }; 

the test fails following:

expected spy function have been called [ object({ big: "fat object" }) ] actual calls [ ({ big: "fat object" }) ]. 

note how expectation has "object" wrapping around it, second not. test did not fail in < 2.0 of jasmine, failing after update jasmine. how can fix this?

update: tinkered around creating new object via newing function vs. object literal syntax, , appears __proto__s different. perhaps affects jasmine's equality comparison?

prior version 2, objects equal if have same properties , values (see v1.3.1 code)

from version 2 onward, object constructors compared (see v2.0 code).

in case: customcriteria , {} not have same constructor.

p.s.: exception message changed contain constructor name in it.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -