Skip to content
Chai support for assertions on array elements http://chaijs.com/plugins/chai-things
CoffeeScript JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
lib
test
.gitignore
.jshintrc
LICENSE.md
README.md
package.json

README.md

Chai Things

Chai Things adds support to Chai for assertions on array elements.

Example

// Although they are equal, two different { a: 1 } objects are not the same
[{ a: 1 }, { b: 2 }].should.not.include({ a: 1 })
// However, Chai Things allows us to test what we want
[{ a: 1 }, { b: 2 }].should.include.something.that.deep.equals({ b: 2 })
// If the test fails, we get a descriptive message
[{ a: 1 }, { b: 2 }].should.include.something.that.deep.equals({ c: 3 })
/* expected an element of [ { a: 1 }, { b: 2 } ] to deeply equal { c: 3 } */

Installation and usage

$ npm install chai-things
var chai = require("chai");
chai.should();
chai.use(require('chai-things'));
Something went wrong with that request. Please try again.