diff options
author | Alex Early <alexander.early@gmail.com> | 2018-07-08 16:58:36 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-08 16:58:36 -0700 |
commit | e4751178540a3c6e64598b93977481ec599704d2 (patch) | |
tree | dce5731bdb1076971d2e4a0a42fbe0d95c720185 /test/transform.js | |
parent | 6405b109fe60541ff42d7638ac891d321d6a7bb3 (diff) | |
download | async-e4751178540a3c6e64598b93977481ec599704d2.tar.gz |
ES6-ify codebase (#1553)
* cancelable foreach
* cancelable waterfall
* cancellable auto
* fix lint
* fix tests
* cancelable whilst/until/during/forever
* fix waterfall test. It WILL get there
* docs
* use rest params instead of slice
* clean up internals
* remove property func
* clarify uses of createTester
* happy path async funtions in asyncify
* stop using arguments
* DLL to class
* moar arrows
* fix merge issues
* remove forOwn
* moar arrows
* fix merge mistake
* even more arrows, what can stop him
* mo more fn.apply(null,...)
* remove more spurious uses of apply
* update lint config
* just when you thought there couldn't possibly be more arrows
* use eslint:recommended
* even less uses or aguments
* get rid of prototype cuteness
* fix concat tests
* fix more tests
Diffstat (limited to 'test/transform.js')
-rw-r--r-- | test/transform.js | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/test/transform.js b/test/transform.js index a02b54b..e8ab5d5 100644 --- a/test/transform.js +++ b/test/transform.js @@ -1,25 +1,25 @@ var async = require('../lib'); var expect = require('chai').expect; -describe('transform', function() { +describe('transform', () => { - it('transform implictly determines memo if not provided', function(done) { - async.transform([1,2,3], function(memo, x, v, callback){ + it('transform implictly determines memo if not provided', (done) => { + async.transform([1,2,3], (memo, x, v, callback) => { memo.push(x + 1); callback(); - }, function(err, result){ + }, (err, result) => { expect(result).to.eql([2, 3, 4]); done(); }); }); - it('transform async with object memo', function(done) { - async.transform([1,3,2], {}, function(memo, v, k, callback){ - setTimeout(function() { + it('transform async with object memo', (done) => { + async.transform([1,3,2], {}, (memo, v, k, callback) => { + setTimeout(() => { memo[k] = v; callback(); }); - }, function(err, result) { + }, (err, result) => { expect(err).to.equal(null); expect(result).to.eql({ 0: 1, @@ -30,31 +30,31 @@ describe('transform', function() { }); }); - it('transform iterating object', function(done) { - async.transform({a: 1, b: 3, c: 2}, function(memo, v, k, callback){ - setTimeout(function() { + it('transform iterating object', (done) => { + async.transform({a: 1, b: 3, c: 2}, (memo, v, k, callback) => { + setTimeout(() => { memo[k] = v + 1; callback(); }); - }, function(err, result) { + }, (err, result) => { expect(err).to.equal(null); expect(result).to.eql({a: 2, b: 4, c: 3}); done(); }); }); - it('transform error', function(done) { - async.transform([1,2,3], function(a, v, k, callback){ + it('transform error', (done) => { + async.transform([1,2,3], (a, v, k, callback) => { callback('error'); - }, function(err){ + }, (err) => { expect(err).to.equal('error'); done(); }); }); - it('transform with two arguments', function(done) { + it('transform with two arguments', (done) => { try { - async.transform([1, 2, 3], function (a, v, k, callback) { + async.transform([1, 2, 3], (a, v, k, callback) => { callback(); }); done(); |