Skip to content

Commit

Permalink
test: make sure bulk tests catch all errors
Browse files Browse the repository at this point in the history
Won't change the actual result of the test, but makes sure errors
cause a quick error rather than an uncaught error causing a stall
  • Loading branch information
daprahamian committed Mar 7, 2019
1 parent d5873f8 commit f73bd06
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions test/functional/promises_collection_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,16 @@ describe('Promises (Collection)', function() {
var db = client.db(configuration.db);
var bulk = db.collection('unordered_bulk_promise_form').initializeUnorderedBulkOp({ w: 1 });
bulk.insert({ a: 1 });
bulk.execute().then(function(r) {
test.ok(r);
test.deepEqual({ w: 1 }, bulk.s.writeConcern);
return bulk
.execute()
.then(function(r) {
test.ok(r);
test.deepEqual({ w: 1 }, bulk.s.writeConcern);

client.close();
done();
});
client.close();
done();
})
.catch(done);
});
}
});
Expand All @@ -352,13 +355,16 @@ describe('Promises (Collection)', function() {
var db = client.db(configuration.db);
var bulk = db.collection('unordered_bulk_promise_form').initializeOrderedBulkOp({ w: 1 });
bulk.insert({ a: 1 });
bulk.execute().then(function(r) {
test.ok(r);
test.deepEqual({ w: 1 }, bulk.s.writeConcern);
return bulk
.execute()
.then(function(r) {
test.ok(r);
test.deepEqual({ w: 1 }, bulk.s.writeConcern);

client.close();
done();
});
client.close();
done();
})
.catch(done);
});
}
});
Expand Down

0 comments on commit f73bd06

Please sign in to comment.