Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fizker/chai-helpers
A collection of various chai helper functions.
https://github.com/fizker/chai-helpers
Last synced: 4 days ago
JSON representation
A collection of various chai helper functions.
- Host: GitHub
- URL: https://github.com/fizker/chai-helpers
- Owner: fizker
- Created: 2013-03-10T21:12:55.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-03-15T12:27:12.000Z (over 11 years ago)
- Last Synced: 2024-10-18T09:36:45.635Z (about 1 month ago)
- Language: JavaScript
- Size: 113 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
chai-helpers
============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 ]).not.to.approximate([ 2, 3 ])
expect({ a: 1, b: { c: 2, d: 'some value' } })
.to.approximate({ a: 1, b: { c: 2 } })