jest-ajv

1.0.3 • Public • Published

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);
    });
}
...

Readme

Keywords

Package Sidebar

Install

npm i jest-ajv

Weekly Downloads

173

Version

1.0.3

License

MIT

Last publish

Collaborators

  • jayjaycross