Section 6 - Adding Unit Tests modified to make testing more flexible.
Synchronous tests like:
// Assert that the getANumber function is returning 1
unit['helpers.getANumber should return 1'] = function(/* done */){
var val = helpers.getANumber();
assert.equal(val, 1);
// done();
};
Does not require callback function (done) anymore.
On the other hand, async tests still works when callback function is passed:
// Logs.list should callback an array and a false error
unit['logs.list should callback a false error and an array of log names'] = function(done){
logs.list(true,function(err,logFileNames){
assert.equal(err, false);
assert.ok(logFileNames instanceof Array);
assert.ok(logFileNames.length > 1);
done();
});
};
So test runner now is more flexible and reduces boilerplate for sync functions.
Section 6 - Adding Unit Tests modified to make testing more flexible.
Synchronous tests like:
Does not require callback function (done) anymore.
On the other hand, async tests still works when callback function is passed:
So test runner now is more flexible and reduces boilerplate for sync functions.