chai-deep-match

1.2.1 • Public • Published

chai-deep-match

GitHub Latest Release Build Status Coverage Status Dependency Status Dev Dependency Status

Extends Chai with an assertion for deeply matching objects (i.e. subset equality checking).

Install

$ npm install --save chai
$ npm install --save chai-deep-match

Usage

var chai = require('chai');
var chaiDeepMatch = require('chai-deep-match');
 
chai.use( chaiDeepMatch );
 
 
chai.expect( { a: 'foo', b: 'bar', c: 'baz' } ).to.deep.match( { a: 'foo', c: 'baz' } );
// =>  pass
 
chai.expect( { a: 'foo', b: 'bar', c: 'baz' } ).to.not.deep.match( { a: 'fuzz', c: 'baz' } );
// =>  pass

Note about URL objects

This module also supports WHATWG URL objects, as introduced in Node 7.x (and backported into Node 6.x, it seems). However, it is important to note that the behavior by which it compares two URL objects will only consider them deeply matched if they are a full 100% match rather than a "subset" match. Hopefully this behavior is acceptable to those making use of it! 🙏

License

Copyright (c) 2016-2018, James M. Greene (MIT License)

/chai-deep-match/

    Package Sidebar

    Install

    npm i chai-deep-match

    Weekly Downloads

    120,372

    Version

    1.2.1

    License

    MIT

    Unpacked Size

    78 kB

    Total Files

    6

    Last publish

    Collaborators

    • jamesmgreene