When I call an API to make a delete request, it returns {}
as request.body.result
. I need to assert that the returned value {}
is equal to my MOCK_RESPONSE
:
{
result:{}
}
The test fails with the following error:
expected {} to equal {}
This is true; but how could I pass this test, since the expected response is correct?
.deep
Chai has .deep
, so you can do:
assert(
actualResponse
).to.deep.equal(
expectedResponse
)
.equal
uses ===
equality, but the .deep
segment changes that behavior:
Causes all .equal, .include, .members, .keys, and .property assertions that follow in the chain to use deep equality instead of strict (===) equality. See the deep-eql project page for info on the deep equality algorithm: https://github.com/chaijs/deep-eql.