The right way to compare arrays with Chai
•
Don’t use “deep equals” when comparing arrays with Chai; it depends on element order. Examine the array members instead.
// Fails
expect(['b', 'a']).to.deep.equal(['a', 'b'])
// Passes
expect(['b', 'a']).to.have.members(['a', 'b'])
Sign up for my newsletter
A monthly round-up of blog posts, projects, and internet oddments.