Last Updated: March 12, 2018
·
2.997K
· kanshuYokoo

Javascript. mocha assertion array.

When testing the javascript class method which return array.
Use assert.deepEqual instead of assert.equal or assert.strictEqual

const expected = [1, 2, 3];
const actual = testClass.getdata(); // return [1,2,3]
assert.deepEqual(expected, actual);

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Did you know?

JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.

Security insights from Cside