Added failing test for done returning null

This commit is contained in:
Mikael Arneborn
2016-03-01 11:23:40 -08:00
parent 1da6c7cf85
commit b578e72c8f

View File

@@ -220,6 +220,22 @@ describe("QueueRunner", function() {
jasmine.clock().tick(1);
expect(nextQueueableFn.fn.calls.count()).toEqual(1);
});
it("should return a null when you call done", function () {
// Bluebird promises want handlers to return anything but undefined to help catch "forgotten returns".
// http://bluebirdjs.com/docs/warning-explanations.html#warning-a-promise-was-created-in-a-handler-but-none-were-returned-from-it
// When doing ".finally(done, done.fail)" done and done.fail are hanlders so need to return null.
var doneReturn,
queueableFn = { fn: function(done) {
doneReturn = done();
} },
queueRunner = new jasmineUnderTest.QueueRunner({
queueableFns: [queueableFn]
});
queueRunner.execute();
expect(doneReturn).toBe(null);
});
});
it("calls exception handlers when an exception is thrown in a fn", function() {