I'm working to understand unit testing in JavaScript, using Mocha/Sinon/Chai. I have seen the function done()
used. But I cannot seem to find documentation for this function. It does not seem to be a part of the JavaScript language. If it were, I would expect to see it in the Mozilla documentation under [something].prototype.done()
. But it's not there. I don't see it under jQuery's documentation, nor under Mocha's.
On another thread, I see this example of done()
:
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();
})
})
What is done()
, what language or tooling is it a part of, and where is the documentation for it? Is done()
just a naming convention for a callback function?