There is the documentation for Mocha. There is the following code sample:
it('should take less than 500ms', function (done) {
this.timeout(500);
setTimeout(done, 300);
});
Also, the following test is valid:
it('should take less than 500ms', function () {
});
What JavaScript tools does Mocha use to determine if someone will use the done
or not?
E.g. if I have a method:
function incrementIfExpectsSomething(callback) {
if(/*callback has a parameter in its definition*/) {
//increment
}
}
How could I implement the /*callback has a parameter in its definition*/
part?
I do not have any applications straight away. I am asking this question just to have a better knowledge of the JavaScript.
Aucun commentaire:
Enregistrer un commentaire