Chai assertion to check an array of objects.
Developed at the Media Engineering Institute (HEIG-VD).
$> npm install --save-dev chai-objects
const chai = require('chai');
chai.use(require('chai-objects'));
chai.expect([
{ corge: 'grault' }, // this object is expected
{ qux: 'warply' } // this object is not expected
]).to.have.objects([
{ foo: 'bar' }, // this object is missing
{ bar: { baz: 'qux' } }, // this object is missing
{ corge: 'grault' },
]);
// AssertionError: expected to find the following missing objects:
// - {"foo":"bar"}
// - {"bar":{"baz":"qux"}}
//
// The following extra objects were found:
// - {"qux":"warply"}