chai-objects

1.0.0 • Public • Published

chai-objects

Chai assertion to check an array of objects.

npm version Dependency Status Build Status Coverage Status License

Developed at the Media Engineering Institute (HEIG-VD).

Installation

$> npm install --save-dev chai-objects

Usage

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"}

Readme

Keywords

Package Sidebar

Install

npm i chai-objects

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • alphahydrae