I'm working on trying to write an asynchronous
test with mocha
using the done();
call. This is my code so far.
it('should have data.', function () {
db.put(collection, key, json_payload)
.then(function (result) {
result.should.exist;
done();
})
.fail(function (err) {
err.should.not.exist;
done();
})
})
The result however is that the code just executes without waiting for the then or fail to actually return with a result. Does done();
need to be at a different place within the code?
Also posted the whole repo right here: https://github.com/Adron/node_testing_testing