Reputation: 3279
I'm trying to use Chai, but I cannot get the deep equal comparison to work for some reason.
This is a minimum example
var chai = require('chai');
var expect = chai.expect;
...
expect({
test: {a:2}
}).to.have.deep.property('test', {a:2});
That generates this output
AssertionError: expected { test: { a: 2 } } to have a deep property 'test' of { a: 2 }, but got { a: 2 }
I'm using Chai 3.5.0 and would expect this assertion to be true.
Upvotes: 2
Views: 698
Reputation: 106
For version 4.0.0 they have changed behavior of '.have.deep' You can see release notes here
I suggest you to update chai if it is possible.
Upvotes: 1
Reputation: 92521
You have to upgrade to a newer version of Chai. This feature was introduced in Chai 4, see 4.x.x Complete Migration Guide.
Upvotes: 3