chai-subset
"containSubset" object properties matcher for Chai assertion library
Installation
npm install --save-dev chai-subset
Usage
common.js
var chai = ;var chaiSubset = ;chai;
in your spec.js
var obj = a: 'b' c: 'd' e: foo: 'bar' baz: qux: 'quux' ; to;//or with 'not'tonot;
Also works good with arrays and should
interface
var list = a: 'a' b: 'b' v: 'f' d: z: 'g'; listshould; //Assertion error is not thrownlistshould; //Assertion error is not thrown listshould; /*throwsAssertionError: expected[ { "a": "a", "b": "b" }, { "v": "f", "d": { "z": "g" } }]to contain subset [ { a: 'a', b: 'bd' } ]*/