chai-samsam
v0.0.2
Published
Deep matching chai assertions using samsam
Downloads
5,899
Maintainers
Readme
chai-samsam
Extends Chai with an assertion for deeply matching just about any kind of object using samsam.
This project started out as a fork of chai-deep-match.
Its interface and test cases have been retained and all pass. Thus it can be used as a drop in replacement.
However, it allows for much looser and deeper matching. (See the samsam docs)
Install
$ npm install --save chai
$ npm install --save chai-samsam
Usage
const chai = require('chai')
const chaiSamSam = require('chai-samsam')
chai.use(chaiSamSam)
expect([{
firstName: 'John',
lastName: 'Doe',
jobs: [{ bartender: true, barista: true }]
}]).to.deep.match([
{ jobs: [{ barista: true }] }
])
// => pass
expect([{
firstName: 'John',
lastName: 'Doe',
jobs: [{ bartender: true, barista: true }]
}]).to.not.deep.match([
{ jobs: [{ pilot: true }] }
])
// => pass
// also possible
assert.deepMatch(a, b)
assert.notDeepMatch(a, b)
License
Copyright (c) 2017, Tim Beyer (MIT License)