Skip to content

TimBeyer/chai-samsam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

chai-samsam Build Status codecov

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)

About

Deep matching chai assertions using samsam

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published