quick_check.js

The quick_check.js Developer Hub

Welcome to the quick_check.js developer hub. You'll find comprehensive guides and documentation to help you start working with quick_check.js as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Generator Transformation

Advanced tutorial

The contents of this document should be considered advanced and is provided mostly for interest. You do not need to understand this document in order to use quick_check.js to its full potential.

qc.map ⸬ (a → b) → Gen a → Gen b

This allows you to define a generator in terms of another generator. This function is curried.

qc.of ⸬ a → Gen a

Creates a generator based on a constant value. This generator returns the constant value passed into it. In effect, it works like Lodash's _.constant function.

expect(function(a) {
  return a === 5;
}).forAll(qc.of(3));
expect (a) ->
  a == 5
.forAll qc.of 3
expect(a => a === 5).forAll(qc.of(3));

qc.join ⸬ Gen (Gen a) → Gen a

Takes a generator generator and returns a generator. This way you can unwrap unnecessarily complex values.

Generator Transformation