Validate queueableFns
This commit is contained in:
@@ -8291,6 +8291,17 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
||||
function QueueRunner(attrs) {
|
||||
this.id_ = nextid++;
|
||||
this.queueableFns = attrs.queueableFns || [];
|
||||
|
||||
for (const f of this.queueableFns) {
|
||||
if (!f) {
|
||||
throw new Error('Received a falsy queueableFn');
|
||||
}
|
||||
|
||||
if (!f.fn) {
|
||||
throw new Error('Received a queueableFn with no fn');
|
||||
}
|
||||
}
|
||||
|
||||
this.onComplete = attrs.onComplete || emptyFn;
|
||||
this.clearStack =
|
||||
attrs.clearStack ||
|
||||
|
||||
@@ -1,4 +1,20 @@
|
||||
describe('QueueRunner', function() {
|
||||
it('validates that queueableFns are truthy', function() {
|
||||
expect(function() {
|
||||
new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [undefined]
|
||||
});
|
||||
}).toThrowError('Received a falsy queueableFn');
|
||||
});
|
||||
|
||||
it('validates that queueableFns have fn properties', function() {
|
||||
expect(function() {
|
||||
new jasmineUnderTest.QueueRunner({
|
||||
queueableFns: [{ fn: undefined }]
|
||||
});
|
||||
}).toThrowError('Received a queueableFn with no fn');
|
||||
});
|
||||
|
||||
it("runs all the functions it's passed", function() {
|
||||
const calls = [],
|
||||
queueableFn1 = { fn: jasmine.createSpy('fn1') },
|
||||
|
||||
@@ -37,6 +37,17 @@ getJasmineRequireObj().QueueRunner = function(j$) {
|
||||
function QueueRunner(attrs) {
|
||||
this.id_ = nextid++;
|
||||
this.queueableFns = attrs.queueableFns || [];
|
||||
|
||||
for (const f of this.queueableFns) {
|
||||
if (!f) {
|
||||
throw new Error('Received a falsy queueableFn');
|
||||
}
|
||||
|
||||
if (!f.fn) {
|
||||
throw new Error('Received a queueableFn with no fn');
|
||||
}
|
||||
}
|
||||
|
||||
this.onComplete = attrs.onComplete || emptyFn;
|
||||
this.clearStack =
|
||||
attrs.clearStack ||
|
||||
|
||||
Reference in New Issue
Block a user