node package manager

Introducing npm Enterprise add-ons. Integrate third-party dev tools into npm…


check partially object properties with chai


Properties matcher for chai

Make assertions that values have all the same attributes and values without asserting strict object equality.

include chai properties after chai:

<script src="lodash.js"></script>
<script src="chai.js"></script>
<script src="chai-properties.js"></script>

have chai use chai-properties:

var chai = require('chai');

partially compare object attributes and values

var subject = { a: 'a', b: 'b', c: 'c' };{ a: 'a' });{ a: 'a', b: 'b' });{ a: 'a', z: 'z' });{ a: '1' });
expect(subject){ a: 'a' });
expect(subject){ a: 'a', b: 'b' });
expect(subject){ a: 'a', z: 'z' });
expect(subject){ a: '1' });
assert.haveProperties(subject, { a: 'a' });
assert.haveProperties(subject, { a: 'a', b: 'b' });
assert.notHaveProperties(subject, { a: 'a', z: 'z' });
assert.notHaveProperties(subject, { a: '1' });