A very simple JSON Schema matcher for jest
jest must be installed
installing via yarn
$ yarn add --dev jest-json-schema-matcher
or npm
$ npm install --save-dev jest-json-schema-matcher
import { jsonSchemaMatcher } from 'jest-json-schema-matcher'
expect.extend(jsonSchemaMatcher)
after this you can use it like
test('jsonSchemaMatcher matches schema', () => {
const schema = {
properties: {
testProp: {
type: 'integer',
},
},
required: ['testProp'],
}
expect({ testProp: 1 }).toMatchSchema(schema)
})
We use SemVer for versioning. For the versions available, see the version on this repository.
This project is licensed under the MIT License - see the LICENSE.md file for details