Open vladlosev opened 10 years ago
For this I would rather recommend:
chai.expect({permissions: {limited: true, admin: true}})
.to.have.property('permissions')
.that.is.deep.equal({limited: true})
;
deep.equal
only works if the set of the properties to compare is known beforehand.
Hi,
Thanks for this very nice chai plugin! IMHO, this functionality so useful, it should be integrated into the chai proper.
But here is the issue I've ran into this issue when using it. Currently, if the object under test has a property X that is itself an object, the assertion will only check that properties of expected.X are a subset of properties in actual.X. This may be dangerous as the users may be expecting the full comparison, and be missing hidden problems such as this one:
It would be nice to perform full equality rather than the subset check on the members of the expected properties, either by default or as a selectable option. Thanks!