Skip to content

Commit f73bd06

Browse files
committed
test: make sure bulk tests catch all errors
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
1 parent d5873f8 commit f73bd06

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

test/functional/promises_collection_tests.js

+18-12
Original file line numberDiff line numberDiff line change
@@ -320,13 +320,16 @@ describe('Promises (Collection)', function() {
320320
var db = client.db(configuration.db);
321321
var bulk = db.collection('unordered_bulk_promise_form').initializeUnorderedBulkOp({ w: 1 });
322322
bulk.insert({ a: 1 });
323-
bulk.execute().then(function(r) {
324-
test.ok(r);
325-
test.deepEqual({ w: 1 }, bulk.s.writeConcern);
323+
return bulk
324+
.execute()
325+
.then(function(r) {
326+
test.ok(r);
327+
test.deepEqual({ w: 1 }, bulk.s.writeConcern);
326328

327-
client.close();
328-
done();
329-
});
329+
client.close();
330+
done();
331+
})
332+
.catch(done);
330333
});
331334
}
332335
});
@@ -352,13 +355,16 @@ describe('Promises (Collection)', function() {
352355
var db = client.db(configuration.db);
353356
var bulk = db.collection('unordered_bulk_promise_form').initializeOrderedBulkOp({ w: 1 });
354357
bulk.insert({ a: 1 });
355-
bulk.execute().then(function(r) {
356-
test.ok(r);
357-
test.deepEqual({ w: 1 }, bulk.s.writeConcern);
358+
return bulk
359+
.execute()
360+
.then(function(r) {
361+
test.ok(r);
362+
test.deepEqual({ w: 1 }, bulk.s.writeConcern);
358363

359-
client.close();
360-
done();
361-
});
364+
client.close();
365+
done();
366+
})
367+
.catch(done);
362368
});
363369
}
364370
});

0 commit comments

Comments
 (0)