We have come across this discussion a few times, but for many people deep.equal is too-strict of an assertion. For example:
The proposal is thus:
Using deep.equal or similar complex assertions, we are able to make much looser assertions about specific parts of the assertion, using an assertion sentinel in place of a value:
expect(o).to.deep.equal({
foo: 'bar',
baz: chai.match.a('function').with.length(2),
});
expect(someSpy).to.be.calledWith('foo', chai.match.a('string').that.matches(/bar/));
We have come across this discussion a few times, but for many people
deep.equalis too-strict of an assertion. For example:jasmine.any.The proposal is thus:
Using
deep.equalor similar complex assertions, we are able to make much looser assertions about specific parts of the assertion, using an assertion sentinel in place of a value: