0.1.2 • Published 8 years ago

chai-match-json v0.1.2

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

matchJSON, for Chai

Travis CI

A way to assert the structure of given JSON.

Examples

It looks like this:

var FIXTURE = {
  name       : 'foo',
  value      : 'bar',
  additional : [ 'prop', 'er', 'ties' ]
};

expect(FIXTURE).to.matchJSON({
  '$.name'  : 'foo',
  '$.value' : 'bar'
});

It uses JSONPath for validating paths. The JSONPath project is well documented with how to specify path selectors (such as $.children[3].prices[price<30]).

Build

$ browserify lib/match-json.js -o chai-match-json.js

Test

$ npm install -g karma-cli
$ npm install
$ karma start
0.1.2

8 years ago

0.1.1

9 years ago

0.1.0

9 years ago