MediaComem / chai-objects

Chai assertion to check an array of objects.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

Chai assertion to check an array of objects.

License:MIT License


Languages

Language:JavaScript 100.0%