mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-01-08 14:01:58 -05:00
Fix TaskQueue constructor when no options passed
This commit is contained in:
parent
be040f4c9b
commit
e6dd3f1175
2 changed files with 10 additions and 1 deletions
|
@ -17,7 +17,7 @@ class TaskQueue {
|
|||
* @property {number} maxTotalCost - reject a task if total queue cost would pass this limit (default: no limit).
|
||||
* @memberof TaskQueue
|
||||
*/
|
||||
constructor (maxTokens, refillRate, options = null) {
|
||||
constructor (maxTokens, refillRate, options = {}) {
|
||||
this._maxTokens = maxTokens;
|
||||
this._refillRate = refillRate;
|
||||
this._pendingTaskRecords = [];
|
||||
|
|
|
@ -36,6 +36,15 @@ test('spec', t => {
|
|||
t.end();
|
||||
});
|
||||
|
||||
test('constructor', t => {
|
||||
t.ok(new TaskQueue(1, 1));
|
||||
t.ok(new TaskQueue(1, 1, {}));
|
||||
t.ok(new TaskQueue(1, 1, {startingTokens: 0}));
|
||||
t.ok(new TaskQueue(1, 1, {maxTotalCost: 999}));
|
||||
t.ok(new TaskQueue(1, 1, {startingTokens: 0, maxTotalCost: 999}));
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('run tasks', async t => {
|
||||
const bukkit = makeTestQueue();
|
||||
|
||||
|
|
Loading…
Reference in a new issue