Jasmine Object Matchers
Custom object equality matchers for use with Jasmine 1.3/Jest, and Jasmine 2.0.
It's a fork of bvaughn/jasmine-object-matchers primarily intended at use with Jest, though they should work in any Jasmine environment (provided you load the correct version of the matchers).
Installing
npm install jasmine-object-matchers-jest --save-dev
Add the matchers to your testing environment with:
Jest/Jasmine 1.3
// Jest: in your `setupTestFramework` scriptjasmine
Jasmine 2.0
Matchers
The following matchers allow simple assertions to be made against an Objects keys or key-value pairs.
toContainKeys
Verifies that an Object contains a minimum set of specified keys. These keys can be provided in the form of an Array:
Or an object:
Additional keys beyond the ones specified are ignored.
toContainValues
Verifies that an Object contains a minimum set of specified key-value pairs.
Additional keys beyond the ones specified are ignored.