How to use jest-json-schema - 2 common examples

To help you get started, we’ve selected a few jest-json-schema examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / jest-json-schema / jest-json-schema-tests.ts View on Github external
import { matchersWithOptions } from 'jest-json-schema';

expect.extend(
    matchersWithOptions(
        {
            formats: {
                test: /^test$/,
            },
        },
        ajv => {
            ajv.addKeyword('test', {
                validate: (schema: any, data: string) => {
                    return schema && data === 'test';
                },
                metaSchema: {
                    type: 'boolean',
                },
            });
        },
    ),
github Zilliqa / Zilliqa-JavaScript-Library / jest-framework-setup.js View on Github external
const { matchersWithOptions } = require('jest-json-schema');
expect.extend(matchersWithOptions({ allErrors: true }));

jest-json-schema

JSON schema matcher for jest

Apache-2.0
Latest version published 11 months ago

Package Health Score

81 / 100
Full package analysis

Popular jest-json-schema functions

Popular JavaScript code snippets

Find secure code to use in your application or website