Back to All

How can I use Quickcheck when the function under test is actually a promise?

I want to test with qc with mocha with forAll, but it doesn't work well with Promise syntax:

it('calling promiseThatReturnsZero should return zero', (done) => {
    qc.forAll(qc.array.subsetOf([1,2,3]), function(someList) {
        promiseThatReturnsZero(someList)
            .done((result) => {
                result.should.be.equal(0);
                done(); // test terminates after first invocation??!?
            });
    });

});

It's a lot of nesting, but you don't get the clarity :/