chai test array equality doesn't work as expected

chai, mocha.js, node.js

Solution

For expect, `.equal` will compare objects rather than their data, and in your case it is two different arrays.

Use `.eql` in order to deeply compare values. Check out this link. Or you could use `.deep.equal` in order to simulate same as `.eql`. Or in your case you might want to check `.members`.

For asserts you can use `.deepEqual`, link.

Problem

Why does the following fail? ``` expect([0,0]).to.equal([0,0]); ``` and what is the right way to test that?

Original source