rapid-check
Yet another implementation of property based testing framework with support for async properties.
Prerequisities
It's based on async generators, therefore it requires nodejs >=10.
Installation
npm install rapid-check
Usage
Works with any testing framework, here's an example using jest >=23:
const gen = const toMatchProperty = expect
Generators
constantly(any)
// [4, 4, 4, 4, ...]
choose(min, max)
// [2, 1, 3, 1, ...]
bool
// [true, true, false, true, ...]
int
// [0, 1, -2, 3, ...]
uint
// [0, 1, 0, 3, ...]
tuple(...gens)
// [[0, 0], [1, 0], [1, 2], [0, 1], ...]
array(gen, min, max)
// [[0], [1], [2, 0], [1, 1], [0], [0, 3, 3], ...]
oneOf(...gens)
// [true, 1, 2, false, ...]
fmap(f, gen)
Where f: a -> b
const negate = -n// [0, -1, -1, -3, ...]
mbind(f, gen)
Where f: a -> Gen b
const f = // [[], [true], [false, false], [false], ... [true, false, false, true, false], [false]]