Tii
Tii is an small assertion library and test runner.
Supported assertions:
- Equality using lodash
isEqual
. - Inequality using lodash
isEqual
. - Truthy
- Falsy
- Gratter
- Smaller
installation
$ npm install tii
usage
;// or; var myTests = ; // --- assert equal ---myTests; // --- assert inequality ---myTests; // --- output the short results ---myTests;
methods
Tii.setUp(callback)
: sets a callback to run before every test.
Tii.clenUp(callback)
: sets a callback to run before every test.
Tii.results()
: short log of the results of the assertions plus a log of the failing ones, if there are some 😉
Tii.verboseOutput(verbose = true)
: Sets/unsets the verbose output. You can set and unset for specific assertions.
myTests; // following assertions will have verbose output do some assertions here myTests // further assertions will not output the result
Tii.when(description)
: Adds an assertion and stores its optional description. Chainable.
Tii.should(a)
: Stores the first value of the assertion, into the last assertion added. Chainable.
assertion methods
this methods run set up callback, the assertion and the clean up callback.
a is the first value added through Tii.should(a)
;
Tii.equal(b)
: expects isEqual(a,b)
to be true.
Tii.not(a)
: expects !isEqual(a,b)
to be true.
Tii.beTrue()
:expects !!a
to be true.
Tii.beFalse()
:expects !a
to be true.
Tii.beMore()
:expects a > b
to be true.
Tii.beLess()
:expects a < b
to be true.