Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

22 lines (15 sloc) 0.759 kB


A collection of various chai helper functions.

In Node.js, it is set up by calling require('finc-chai-helpers').addMethods(chai) before running any tests.

Currently, there are one helper:

  • approximate: Compared two objects recursively just as deep.equal(expected), but does not require all values to be equal. It is perfect for testing that key values are present in an object, without requiring that no optional (or future) values are present.

    Example (all examples evaluate to passed):

    expect([ 1, 2, 3 ]).to.approximate([ 1, 2 ])
    expect([ 1, 2, 3 ])[ 2, 3 ])
    expect({ a: 1, b: { c: 2, d: 'some value' } })
        .to.approximate({ a: 1, b: { c: 2 } })
Jump to Line
Something went wrong with that request. Please try again.