Last necessary test

pull/2/head
Louis Chatriot 9 years ago
parent be83e8d4ee
commit 41827a51e1
  1. 2
      lib/executor.js
  2. 23
      test/executor.test.js

@ -28,7 +28,7 @@ function Executor () {
} }
lastArg.apply(null, arguments); lastArg.apply(null, arguments);
}; };
} else if (!lastArg && task.arguments.length) { } else if (!lastArg && task.arguments.length !== 0) {
// false/undefined/null supplied as callbback // false/undefined/null supplied as callbback
newArguments[newArguments.length - 1] = function () { cb(); }; newArguments[newArguments.length - 1] = function () { cb(); };
} else { } else {

@ -99,8 +99,6 @@ function testRightOrder (d, done) {
}); });
} }
// Note: The following test does not have any assertion because it // Note: The following test does not have any assertion because it
// is meant to address the deprecation warning: // is meant to address the deprecation warning:
// (node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral. // (node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.
@ -116,7 +114,18 @@ var testEventLoopStarvation = function(d, done){
done(); done();
}; };
describe('Executor', function () { // Test that operations are executed in the right order even with no callback
function testExecutorWorksWithoutCallback (d, done) {
d.insert({ a: 1 });
d.insert({ a: 2 }, false);
d.find({}, function (err, docs) {
docs.length.should.equal(2);
done();
});
}
describe.only('Executor', function () {
describe('With persistent database', function () { describe('With persistent database', function () {
var d; var d;
@ -162,6 +171,10 @@ describe('Executor', function () {
testEventLoopStarvation(d, done); testEventLoopStarvation(d, done);
}); });
it('Works in the right order even with no supplied callback', function(done){
testExecutorWorksWithoutCallback(d, done);
});
}); // ==== End of 'With persistent database' ==== }); // ==== End of 'With persistent database' ====
@ -191,6 +204,10 @@ describe('Executor', function () {
testRightOrder(d, done); testRightOrder(d, done);
}); });
it('Works in the right order even with no supplied callback', function(done){
testExecutorWorksWithoutCallback(d, done);
});
}); // ==== End of 'With non persistent database' ==== }); // ==== End of 'With non persistent database' ====
}); });

Loading…
Cancel
Save