|
|
|
@ -38,7 +38,7 @@ function testThrowInCallback (d, done) { |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//Test that if the callback is falsy, the next DB operations will still be executed
|
|
|
|
|
// Test that if the callback is falsy, the next DB operations will still be executed
|
|
|
|
|
function testFalsyCallback (d, done) { |
|
|
|
|
d.insert({ a: 1 }, null); |
|
|
|
|
process.nextTick(function () { |
|
|
|
@ -99,8 +99,6 @@ function testRightOrder (d, done) { |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Note: The following test does not have any assertion because it
|
|
|
|
|
// 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.
|
|
|
|
@ -114,9 +112,20 @@ var testEventLoopStarvation = function(d, done){ |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
done(); |
|
|
|
|
}; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
// 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('Executor', function () { |
|
|
|
|
describe.only('Executor', function () { |
|
|
|
|
|
|
|
|
|
describe('With persistent database', function () { |
|
|
|
|
var d; |
|
|
|
@ -162,6 +171,10 @@ describe('Executor', function () { |
|
|
|
|
testEventLoopStarvation(d, done); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
it('Works in the right order even with no supplied callback', function(done){ |
|
|
|
|
testExecutorWorksWithoutCallback(d, done); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
}); // ==== End of 'With persistent database' ====
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -191,6 +204,10 @@ describe('Executor', function () { |
|
|
|
|
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' ====
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|