Skip to content

roberto/chakram-joi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Chakram-Joi

Chakram assertion for checking responses using Joi schema.

Installation

npm install --save-dev chakram-joi

Setup

chakram.addMethod('joi', require('chakram-joi'));

Basic Usage

const schema = joi.object().keys({
  name: joi.string()
});

expect(response).to.joi(schema);

Custom Options

Joi has several options for validation and it's possible to use them as shown bellow:

expect(response).to.joi(schema, { abortEarly: false });

Default options:

abortEarly: true      # stops validation on the first error
presence: 'required'  # declared items must be found
allowUnknown: true    # unknown object keys are ignored

License

MIT

About

Chakram assertion for Joi schema.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published