Cress Type
This is an addon plugin for the Jest test framework, the chai assertion library and the should.js assertion library. It provides the most basic function type compare ability and tests.
Installation
Node.js
Cress Type are available on npm.
$ npm install cress-type
Usage
Use As a Jest Plug In
In order to load the plugin, add Jest config option
to the package.json
file:
// package.json ... "jest":
Then you can use it in Jest test files:
// __tests__/example.js data1 = 'example' 1 user: name: 'cress' age: 99 data2 = 'another example' 2 user: name: 'haha' age: 0
Use As a Chai Plug In
var chai = compatible = ; chai; var should = chai expect = chaiexpect; data1 = 'example' 1 user: name: 'cress' age: 99 data2 = 'another example' 2 user: name: 'haha' age: 0 //expect modetobe //should modedata1shouldbe
Use As a Should.js Plug In
var Should = compatible = ; Should; data1 = 'example' 1 user: name: 'cress' age: 99 data2 = 'another example' 2 user: name: 'haha' age: 0 data1shouldbe
Use Not As Plug In
var compatible = ; data1 = 'example' 1 user: name: 'cress' age: 99 data2 = 'another example' 2 user: name: 777 age: 0 //will output: {isCompatible: false, path: '[2].user.name'}// which means// typeof data1[2].user.name !== typeof data2[2].user.name
License
(The MIT License)