Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mocha, chai, Uncaught AssertionError: expected {} to equal {} + expected - actual [duplicate]

Tags:

mocha.js

chai

  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
like image 596
Limarenko Denis Avatar asked Jul 21 '16 07:07

Limarenko Denis


1 Answers

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({});
like image 192
robertklep Avatar answered Nov 06 '22 05:11

robertklep