chai-shallow-deep-almost-equal
It's a fork of https://github.com/michelsalib/chai-shallow-deep-equal which adds .001 float treshold almost-equality feature.
Will shallowly perform a deep almost equal assertion. In other terms is consist of checking that an object, or objects graph, is contained within another one (see examples bellow).
Usage
Browser
Node
var chai = ;chai;
Assertions
ShallowDeepAlmostEqual is available for all chai assertion styles:
var a = x: 10 y: 10;var b = x: 10001; ashould;to;assert;
Example
assert; // trueassert; // true// assert.ShallowDeepAlmostEqual({x: 10, y: 10}, {x: 9.9}); // fails // the rest are the original shallowDeepEqualTestsassert; // true assert; // true assert; // false (age should not be defined)