I am using mocha and chai for testing nodejs api calls, I am new to mocha and chai. I am using asyn.waterfall to confrom flow of my code but its not working.I debugged my code and found out after reaching to the first line of async.waterfall is ends and none of the tasks are called.
here is an example code
async.each(users, function (user) {
async.waterfall([
function (callback) {
username = user.username;
if (username == "abc") {
username = "abc-" + moment().unix() + "@abc.com";
}
callback(null, username);
},
function (username, callback) {
describe("Test " + username, function () {
it("Tesiting 1", function (done) {
setTimeout(function () {
console.log('hello world!');
done();
}, 1000);
})
it("Tesiting 2", function (done) {
setTimeout(function () {
console.log('hello world!');
done();
}, 1000);
})
})
}],
function (err, result) {
// result now equals 'done'
consol.log("done!");
});
});
Aucun commentaire:
Enregistrer un commentaire