I'm just getting started with JSUnit and with xUnit in general, and was wanted to make sure I'm on the right track.
In one test I am writing I want to compare two (arrays of) object literals:
var defaults = [{ color: "blue", size: 'small'},...];
Simply using assertEquals will fail since they are not the same Object:
assertEquals(defaults, getDefaults()); // Fails
I have found that by using checking myObj.toSource() instead of myObj the test seems to work okay.
assertEquals(defaults.toSource(), getDefaults().toSource()); // Works!
So, my question is: Is this an appropriate method of testing what I want to test? Is there a better method?
Any advice or feedback would be greatly appreciated :)
Thanks!
Keith