diff options
-rw-r--r-- | lib/eachSeries.js | 2 | ||||
-rw-r--r-- | test/es2017/asyncFunctions.js | 4 | ||||
-rw-r--r-- | test/priorityQueue.js | 44 |
3 files changed, 25 insertions, 25 deletions
diff --git a/lib/eachSeries.js b/lib/eachSeries.js index a23aef5..3831456 100644 --- a/lib/eachSeries.js +++ b/lib/eachSeries.js @@ -6,7 +6,7 @@ import awaitify from './internal/awaitify' * * Note, that unlike [`each`]{@link module:Collections.each}, this function applies iteratee to each item * in series and therefore the iteratee functions will complete in order. - + * @name eachSeries * @static * @memberOf module:Collections diff --git a/test/es2017/asyncFunctions.js b/test/es2017/asyncFunctions.js index 68a89e2..805c666 100644 --- a/test/es2017/asyncFunctions.js +++ b/test/es2017/asyncFunctions.js @@ -382,10 +382,10 @@ module.exports = function () { result.push(await Promise.resolve(val)); }, 2) - q.drain = () => { + q.drain(() => { expect(result).to.eql([1, 2, 3]); done(); - }; + }); q.push(1); q.push(2); diff --git a/test/priorityQueue.js b/test/priorityQueue.js index 1a8cc76..96936fd 100644 --- a/test/priorityQueue.js +++ b/test/priorityQueue.js @@ -40,7 +40,7 @@ describe('priorityQueue', () => { expect(q.length()).to.equal(4); expect(q.concurrency).to.equal(1); - q.drain = function () { + q.drain(() => { expect(call_order).to.eql([ 'process 2', 'callback 2', 'process 1', 'callback 1', @@ -50,7 +50,7 @@ describe('priorityQueue', () => { expect(q.concurrency).to.equal(1); expect(q.length()).to.equal(0); done(); - }; + }); }); it('concurrency', (done) => { @@ -95,7 +95,7 @@ describe('priorityQueue', () => { expect(q.length()).to.equal(4); expect(q.concurrency).to.equal(2); - q.drain = function () { + q.drain(() => { expect(call_order).to.eql([ 'process 1', 'callback 1', 'process 2', 'callback 2', @@ -105,7 +105,7 @@ describe('priorityQueue', () => { expect(q.concurrency).to.equal(2); expect(q.length()).to.equal(0); done(); - }; + }); }); it('pause in worker with concurrency', (done) => { @@ -131,10 +131,10 @@ describe('priorityQueue', () => { q.push({ id: 4 }); q.push({ id: 5 }); - q.drain = function () { + q.drain(() => { expect(call_order).to.eql([1, 2, 3, 4, 5]); done(); - }; + }); }); context('q.saturated(): ', () => { @@ -144,10 +144,10 @@ describe('priorityQueue', () => { calls.push('process ' + task); async.setImmediate(cb); }, 4); - q.saturated = function() { + q.saturated(() => { calls.push('saturated'); - }; - q.empty = function() { + }); + q.empty(() => { expect(calls.indexOf('saturated')).to.be.above(-1); setTimeout(() => { expect(calls).eql([ @@ -166,7 +166,7 @@ describe('priorityQueue', () => { ]); done(); }, 50); - }; + }); q.push('foo0', 5, () => {calls.push('foo0 cb');}); q.push('foo1', 4, () => {calls.push('foo1 cb');}); q.push('foo2', 3, () => {calls.push('foo2 cb');}); @@ -206,10 +206,10 @@ describe('priorityQueue', () => { calls.push('process ' + task); setTimeout(cb, 10); }, 4); - q.unsaturated = function() { + q.unsaturated(() => { calls.push('unsaturated'); - }; - q.empty = function() { + }); + q.empty(() => { expect(calls.indexOf('unsaturated')).to.be.above(-1); setTimeout(() => { expect(calls).eql([ @@ -231,7 +231,7 @@ describe('priorityQueue', () => { ]); done(); }, 50); - }; + }); q.push('foo0', 5, () => {calls.push('foo0 cb');}); q.push('foo1', 4, () => {calls.push('foo1 cb');}); q.push('foo2', 3, () => {calls.push('foo2 cb');}); @@ -239,7 +239,7 @@ describe('priorityQueue', () => { q.push('foo4', 1, () => {calls.push('foo4 cb');}); }); }); - + it('should not call the drain callback if receives empty push and tasks are still pending', (done) => { var call_order = []; @@ -247,22 +247,22 @@ describe('priorityQueue', () => { call_order.push('process ' + task); callback('error', 'arg'); }, 1); - + q.push(1, 1, (err, arg) => { expect(err).to.equal('error'); expect(arg).to.equal('arg'); call_order.push('callback ' + 1); }); - + q.push(2, 1, (err, arg) => { expect(err).to.equal('error'); expect(arg).to.equal('arg'); call_order.push('callback ' + 2); }); - + expect(q.length()).to.equal(2); - - q.drain = function () { + + q.drain(() => { expect(call_order).to.eql([ 'process 1', 'callback 1', 'process 2', 'callback 2' @@ -271,8 +271,8 @@ describe('priorityQueue', () => { expect(q.length()).to.equal(0); expect(q.running()).to.equal(0); done(); - }; - + }); + q.push([], 1, () => {}); }); }); |