问题
it('GET /customers/ with wrong id', (done) => {
request
.get(`/customers/${wrongId}`)
.end((err, res) => {
expect(res.body).to.equals({});
expect(res).to.have.status(404);
done();
});
});
1) Customers CRUD GET /customers/ with wrong id:
Uncaught AssertionError: expected {} to equal {}
+ expected - actual
回答1:
You want to use deep if you're trying to compare objects:
expect(res.body).to.deep.equal({});
Or use the eql method:
expect(res.body).to.eql({});
来源:https://stackoverflow.com/questions/38497731/mocha-chai-uncaught-assertionerror-expected-to-equal-expected-actua