diff options
Diffstat (limited to 'test/mapValues.js')
-rw-r--r-- | test/mapValues.js | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/test/mapValues.js b/test/mapValues.js index 612feff..83cc126 100644 --- a/test/mapValues.js +++ b/test/mapValues.js @@ -1,25 +1,25 @@ var async = require('../lib'); var expect = require('chai').expect; -describe('mapValues', function () { +describe('mapValues', () => { var obj = {a: 1, b: 2, c: 3}; - context('mapValuesLimit', function () { - it('basics', function (done) { + context('mapValuesLimit', () => { + it('basics', (done) => { var running = 0; var concurrency = { a: 2, b: 2, c: 1 }; - async.mapValuesLimit(obj, 2, function (val, key, next) { + async.mapValuesLimit(obj, 2, (val, key, next) => { running++; - async.setImmediate(function () { + async.setImmediate(() => { expect(running).to.equal(concurrency[key]); running--; next(null, key + val); }); - }, function (err, result) { + }, (err, result) => { expect(running).to.equal(0); expect(err).to.eql(null); expect(result).to.eql({a: 'a1', b: 'b2', c: 'c3'}); @@ -27,13 +27,13 @@ describe('mapValues', function () { }); }); - it('error', function (done) { - async.mapValuesLimit(obj, 1, function(val, key, next) { + it('error', (done) => { + async.mapValuesLimit(obj, 1, (val, key, next) => { if (key === 'b') { return next(new Error("fail")); } next(null, val); - }, function (err, result) { + }, (err, result) => { expect(err).to.not.eql(null); expect(result).to.eql({a: 1}); done(); @@ -41,22 +41,22 @@ describe('mapValues', function () { }); }); - context('mapValues', function () { - it('basics', function (done) { + context('mapValues', () => { + it('basics', (done) => { var running = 0; var concurrency = { a: 3, b: 2, c: 1 }; - async.mapValues(obj, function (val, key, next) { + async.mapValues(obj, (val, key, next) => { running++; - async.setImmediate(function () { + async.setImmediate(() => { expect(running).to.equal(concurrency[key]); running--; next(null, key + val); }); - }, function (err, result) { + }, (err, result) => { expect(running).to.equal(0); expect(err).to.eql(null); expect(result).to.eql({a: 'a1', b: 'b2', c: 'c3'}); @@ -65,22 +65,22 @@ describe('mapValues', function () { }); }); - context('mapValuesSeries', function () { - it('basics', function (done) { + context('mapValuesSeries', () => { + it('basics', (done) => { var running = 0; var concurrency = { a: 1, b: 1, c: 1 }; - async.mapValuesSeries(obj, function (val, key, next) { + async.mapValuesSeries(obj, (val, key, next) => { running++; - async.setImmediate(function () { + async.setImmediate(() => { expect(running).to.equal(concurrency[key]); running--; next(null, key + val); }); - }, function (err, result) { + }, (err, result) => { expect(running).to.equal(0); expect(err).to.eql(null); expect(result).to.eql({a: 'a1', b: 'b2', c: 'c3'}); |