@ -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
@ -131,6 +150,10 @@ describe('Executor', function () {
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);
});
@ -160,6 +183,10 @@ describe('Executor', function () {
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){