fantasy-check icon indicating copy to clipboard operation
fantasy-check copied to clipboard

QuickCheck Library using Fantasy-Land

Fantasy Check

Build Status Dependencies Status

General

QuickCheck is a form of automated specification testing. Instead of manually writing tests cases like so:

   assert(0 + 1 == 1);
   assert(1 + 1 == 2);
   assert(3 + 3 == 6);

We can just write the assertion algebraically and tell QuickCheck to automatically generate lots of inputs:

   λ.forAll(
       function(n) {
           return n + n == 2 * n;
       },
       [Number]
   ).fold(
       function(fail) {
           return "Failed after " + fail.tries + " tries: " + fail.inputs.toString();
       },
       "All tests passed!",
   )

Testing

Library

Fantasy Check uses nodeunit for all the tests and because of this there is currently an existing adapter in the library to help with integration between nodeunit and Fantasy Check.

Coverage

Currently Fantasy Check is using Istanbul for code coverage analysis; you can run the coverage via the following command:

This assumes that you have istanbul installed correctly.

istanbul cover nodeunit -- test/*.js

It should report that the total coverage is at 100% for the whole lib.