This package has been deprecated

Author message:

This package was deprecated and no longer maintained. Consider using jest-json-schema instead

jasmine-ajv

1.0.1 • Public • Published

jasmine-ajv

Build Status

This plugin was inspired by chai-json-schema and chai-json-schema-ajv.

Installation

npm install --save-dev jasmine-ajv

JSON Schema and Ajv

For any references, please follow

Setup and usage

For Jasmine, you'll need to call install function in any place due to the way jasmine's plugin system works, ex in beforeEach:

const installJsonSchemaMatcher = require('jasmine-ajv');

beforeEach(() => installJsonSchemaMatcher(jasmine));

it('should has toBeJsonSchema matcher', () => {
  expect(pojo).toBeJsonSchema(mySchema);
});

And you can use it even with jest

You need specify setup test file, if you haven't done so. After that add the following code to your setup file:

// setup file

const installJsonSchemaMatcher = require('jasmine-ajv');

installJsonSchemaMatcher(jasmine);

// and later in tests

test('how awesome it is', () => {
  expect(pojo).toBeJsonSchema(mySchema);
});

and you're ready to go!

Browser support

TBD, if you have a PR, you're welcome!

Package Sidebar

Install

npm i jasmine-ajv

Weekly Downloads

2

Version

1.0.1

License

MIT

Last publish

Collaborators

  • maxmalov