jest-joi-schema
v1.0.0
Published
Joi schema matcher for Jest
Downloads
2,669
Readme
jest-joi-schema
Install via npm
npm install jest-joi-schema --save
Usage
In any test file:
import { matchers } from 'jest-joi-schema';
expect.extend(matchers);
or add it directly in setupTestFrameworkScriptFile
.
const joi = require('joi');
const userSchema = joi.object({
firstName: joi.string().required(),
lastName: joi.string().required(),
email: joi.string().email(),
});
const options = { allowUnknown: true };
expect(values).toMatchSchema(
userSchema,
options,
);