@ -38,6 +38,25 @@ function testThrowInCallback (d, done) {
});
}
//Test that if the callback is falsy, the next DB operations will still be executed
functiontestFalsyCallback(d,done){
d.insert({a:1},null);
process.nextTick(function(){
d.update({a:1},{a:2},{},null);
process.nextTick(function(){
d.update({a:2},{a:1},null);
process.nextTick(function(){
d.remove({a:2},{},null);
process.nextTick(function(){
d.remove({a:2},null);
process.nextTick(function(){
d.find({},done);
});
});
});
});
});
}
// Test that operations are executed in the right order
// We prevent Mocha from catching the exception we throw on purpose by remembering all current handlers, remove them and register them back after test ends
@ -130,7 +149,11 @@ describe('Executor', function () {
it('A throw in a callback doesnt prevent execution of next operations',function(done){
testThrowInCallback(d,done);
});
it('A falsy callback doesnt prevent execution of next operations',function(done){
testFalsyCallback(d,done);
});
it('Operations are executed in the right order',function(done){
testRightOrder(d,done);
});
@ -159,7 +182,11 @@ describe('Executor', function () {
it('A throw in a callback doesnt prevent execution of next operations',function(done){
testThrowInCallback(d,done);
});
it('A falsy callback doesnt prevent execution of next operations',function(done){
testFalsyCallback(d,done);
});
it('Operations are executed in the right order',function(done){