jest-ajv

v1.0.3
Jest Ajv schema matcher.
jest ajv matcher

Jest Ajv

Usage

Root import

import 'jest-ajv';

const data = {
    ...
};

const schema = {
    ...
};

...
describe('Data', () => {
    it('should match the schema', () => {
        expect(data).toMatchSchema(schema);
    });
}
...

Matcher import

import toMatchSchema from 'jest-ajv/toMatchSchema';

const data = {
    ...
};

const schema = {
    ...
};

...
describe('Data', () => {
    beforeEach(() => {
        jest.addMatchers({ toMatchSchema });
    });

    it('should match the schema', () => {
        expect(data).toMatchSchema(schema);
    });
}
...
npm i jest-ajv

Metadata

  • MIT
  • Whatever
  • Jack Cross
  • released 3/1/2017

Downloads

Maintainers