Jasmine has built-in matchers toBe
and toEqual
. If I have an object like this:
function Money(amount, currency){
this.amount = amou
If you're looking to compare partial objects, you might consider:
describe("jasmine.objectContaining", function() {
var foo;
beforeEach(function() {
foo = {
a: 1,
b: 2,
bar: "baz"
};
});
it("matches objects with the expect key/value pairs", function() {
expect(foo).toEqual(jasmine.objectContaining({
bar: "baz"
}));
});
});
cf. jasmine.github.io/partial-matching