chai
chai copied to clipboard
lengthOf - comparing lengths of 2 arrays/objects is discouraging, lengthsEqual needed
This code:
assert.equal(res.length, 5);
could be rewrote to:
assert.lengthOf(res, 5);
And it is short and graceful.
But this code:
assert.equal(res.length, res2.length);
could be rewrote only to:
assert.lengthOf(res, res2.length);
which occasionally causes mistakes with omitted or excessive ".length".
More consistent way is to rewrite it to:
assert.lengthsEqual(res, res2);