Unverified Commit 93d96dad by Kewde Committed by GitHub

test: wait for db to unlock first.

parent 65de9a7a
...@@ -10,16 +10,19 @@ describe('each', function() { ...@@ -10,16 +10,19 @@ describe('each', function() {
it('retrieve 100,000 rows with Statement#each', function(done) { it('retrieve 100,000 rows with Statement#each', function(done) {
var total = 100000; var total = 100000;
var retrieved = 0; var retrieved = 0;
db.wait(function() {
db.each('SELECT id, txt FROM foo LIMIT 0, ?', total, function(err, row) {
if (err) throw err;
retrieved++;
});
db.each('SELECT id, txt FROM foo LIMIT 0, ?', total, function(err, row) { db.wait(function() {
if (err) throw err; assert.equal(retrieved, total, "Only retrieved " + retrieved + " out of " + total + " rows.");
retrieved++; done();
});
}); });
db.wait(setTimeout(function() {
assert.equal(retrieved, total, "Only retrieved " + retrieved + " out of " + total + " rows.");
done();
}, 400));
}); });
it('Statement#each with complete callback', function(done) { it('Statement#each with complete callback', function(done) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment