summaryrefslogtreecommitdiff
path: root/test/applyEach.js
diff options
context:
space:
mode:
authorAlex Early <alexander.early@gmail.com>2018-07-08 16:58:36 -0700
committerGitHub <noreply@github.com>2018-07-08 16:58:36 -0700
commite4751178540a3c6e64598b93977481ec599704d2 (patch)
treedce5731bdb1076971d2e4a0a42fbe0d95c720185 /test/applyEach.js
parent6405b109fe60541ff42d7638ac891d321d6a7bb3 (diff)
downloadasync-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/applyEach.js')
-rw-r--r--test/applyEach.js32
1 files changed, 16 insertions, 16 deletions
diff --git a/test/applyEach.js b/test/applyEach.js
index ca5ada3..e164dda 100644
--- a/test/applyEach.js
+++ b/test/applyEach.js
@@ -2,32 +2,32 @@ var async = require('../lib');
var expect = require('chai').expect;
var assert = require('assert');
-describe('applyEach', function () {
+describe('applyEach', () => {
- it('applyEach', function (done) {
+ it('applyEach', (done) => {
var call_order = [];
var one = function (val, cb) {
expect(val).to.equal(5);
- setTimeout(function () {
+ setTimeout(() => {
call_order.push('one');
cb(null, 1);
}, 12);
};
var two = function (val, cb) {
expect(val).to.equal(5);
- setTimeout(function () {
+ setTimeout(() => {
call_order.push('two');
cb(null, 2);
}, 2);
};
var three = function (val, cb) {
expect(val).to.equal(5);
- setTimeout(function () {
+ setTimeout(() => {
call_order.push('three');
cb(null, 3);
}, 18);
};
- async.applyEach([one, two, three], 5, function (err, results) {
+ async.applyEach([one, two, three], 5, (err, results) => {
assert(err === null, err + " passed instead of 'null'");
expect(call_order).to.eql(['two', 'one', 'three']);
expect(results).to.eql([1, 2, 3]);
@@ -35,30 +35,30 @@ describe('applyEach', function () {
});
});
- it('applyEachSeries', function (done) {
+ it('applyEachSeries', (done) => {
var call_order = [];
var one = function (val, cb) {
expect(val).to.equal(5);
- setTimeout(function () {
+ setTimeout(() => {
call_order.push('one');
cb(null, 1);
}, 10);
};
var two = function (val, cb) {
expect(val).to.equal(5);
- setTimeout(function () {
+ setTimeout(() => {
call_order.push('two');
cb(null, 2);
}, 5);
};
var three = function (val, cb) {
expect(val).to.equal(5);
- setTimeout(function () {
+ setTimeout(() => {
call_order.push('three');
cb(null, 3);
}, 15);
};
- async.applyEachSeries([one, two, three], 5, function (err, results) {
+ async.applyEachSeries([one, two, three], 5, (err, results) => {
assert(err === null, err + " passed instead of 'null'");
expect(call_order).to.eql(['one', 'two', 'three']);
expect(results).to.eql([1, 2, 3]);
@@ -66,30 +66,30 @@ describe('applyEach', function () {
});
});
- it('applyEach partial application', function (done) {
+ it('applyEach partial application', (done) => {
var call_order = [];
var one = function (val, cb) {
expect(val).to.equal(5);
- setTimeout(function () {
+ setTimeout(() => {
call_order.push('one');
cb(null, 1);
}, 10);
};
var two = function (val, cb) {
expect(val).to.equal(5);
- setTimeout(function () {
+ setTimeout(() => {
call_order.push('two');
cb(null, 2);
}, 5);
};
var three = function (val, cb) {
expect(val).to.equal(5);
- setTimeout(function () {
+ setTimeout(() => {
call_order.push('three');
cb(null, 3);
}, 15);
};
- async.applyEach([one, two, three])(5, function (err, results) {
+ async.applyEach([one, two, three])(5, (err, results) => {
if (err) throw err;
expect(call_order).to.eql(['two', 'one', 'three']);
expect(results).to.eql([1, 2, 3]);