Explicity set expectations; fail if those expectations are not met.
$ npm install --save @joegesualdo/assert-js
import assert from ('@joegesualdo/assert')
let testStr = 'hello world';
assert.type(testStr, 'boolean');
//=> throws `TypeError`
$ npm test
Name | Type | Required | Default | Description |
---|---|---|---|---|
testVar | N/A |
yes |
N/A |
The variable you want to test |
type | String |
yes |
N/A |
The type the variable should be |
import assert from ('@joegesualdo/assert')
let testStr = 'hello world';
assert.type(testStr, 'boolean');
//=> throws `TypeError`
$ npm run build
MIT © Joe Gesualdo