Socket
Socket
Sign inDemoInstall

chai-expect-uuid

Package Overview
Dependencies
1
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    chai-expect-uuid

Chai plugin for using UUID tests


Version published
Maintainers
1
Install size
10.8 kB
Created

Readme

Source

chai-ajv-json-schema

Chai plugin to allow JSON schema to be used with expect. This is currently a stub and is under heavy development. All contributions are welcome.

##Usage This plugin adds validWithSchema to the expect validation methods.

expect({}).to.be.validWithSchema(['schema1','schema2])
expect({}).to.be.validWithSchema('schema1')

##Simple Example

var chai = require('chai');
var expect = chai.expect;

chai.use(require('chai-ajv-json-schema'))
chai.ajv.addSchema(require('./schemas/complex.json'), "test_schema");

describe("Look we can test against a schema", function(){
  it("checks that doAllTheThings() does all the things.", function(){
    const results = doAllTheThings();
    expect(results).to.validWithSchema("test_schema");
  })
})

##Complicated Example

var meta = require('../meta.json');
var chai = require('chai');
var expect = chai.expect;

chai.use(require('chai-ajv-json-schema'))
chai.ajv = require('../myProject/customAjvValidator')

describe("Look we can test against a schema", function(){
  it("checks that doAllTheThings() does all the things.", function(){
    const schemasNames = meta.methods.doAllTheThings.resultSchemas;
    const results = doAllTheThings();
    expect(results).to.validWithSchema(schemasNames);
  })
})

Keywords

FAQs

Last updated on 26 Jun 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc