Skip to content
This repository has been archived by the owner on Nov 4, 2020. It is now read-only.

Strange behavior with equal #58

Closed
GM-Alex opened this issue Apr 15, 2015 · 2 comments
Closed

Strange behavior with equal #58

GM-Alex opened this issue Apr 15, 2015 · 2 comments

Comments

@GM-Alex
Copy link

GM-Alex commented Apr 15, 2015

If I use

body.should.be.equal({response: 'ok'});

to test if a response returns the right content, the test fails because it says the result is not identical, but they are. Here is the error:

AssertionError: expected { response: 'ok' } to be { response: 'ok' }

And here the expected

{
  "response": "ok"
}

and the given return value

{
  "response": "ok"
}

Which are obviously the same.

@btd
Copy link
Member

btd commented Apr 15, 2015

.equal inside it is ===, which of cause will not work for deep comparison. You need to use .eql there which do deep comparison.

@btd btd closed this as completed Apr 15, 2015
@GM-Alex
Copy link
Author

GM-Alex commented Apr 15, 2015

@btd Didn't notice that. Many thanks for your help.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants