Socket
Book a DemoInstallSign in
Socket

chai-match-json

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chai-match-json

A Chai plugin for validating JSON paths

latest
Source
npmnpm
Version
0.1.2
Version published
Maintainers
1
Created
Source

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

Keywords

chai

FAQs

Package last updated on 17 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts