Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should assert.deepEqual([], {}) pass and not throw an AssertionError #2657

Closed
jonjitsu opened this issue Sep 2, 2015 · 1 comment
Closed
Labels
assert Issues and PRs related to the assert subsystem. question Issues that look for answers.

Comments

@jonjitsu
Copy link

jonjitsu commented Sep 2, 2015

I was under the impressiong that

assert.deepEqual([], {})

would throw an AssertionError but currently is doesn't and passes tests. Is this a bug or by design? Or maybe just accepted since they are both empty and an array is technically an object.

If this is acceptable behavior, what is the recommended way to test? Is it to test type then a second test for deepEqual?

@thefourtheye thefourtheye added question Issues that look for answers. assert Issues and PRs related to the assert subsystem. labels Sep 2, 2015
@cjihrig
Copy link
Contributor

cjihrig commented Sep 2, 2015

deepEqual() does not take prototypes into account. You can get around this using deepStrictEqual().

@cjihrig cjihrig closed this as completed Sep 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assert Issues and PRs related to the assert subsystem. question Issues that look for answers.
Projects
None yet
Development

No branches or pull requests

3 participants