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/whilst.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/whilst.js')
-rw-r--r-- | test/whilst.js | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/test/whilst.js b/test/whilst.js index 2ce2f23..844e559 100644 --- a/test/whilst.js +++ b/test/whilst.js @@ -2,23 +2,23 @@ var async = require('../lib'); var expect = require('chai').expect; var assert = require('assert'); -describe('whilst', function(){ - it('whilst', function(done) { +describe('whilst', () => { + it('whilst', (done) => { var call_order = []; var count = 0; async.whilst( - function (c) { + (c) => { expect(c).to.equal(undefined); call_order.push(['test', count]); return (count < 5); }, - function (cb) { + (cb) => { call_order.push(['iteratee', count]); count++; cb(null, count); }, - function (err, result) { + (err, result) => { assert(err === null, err + " passed instead of 'null'"); expect(result).to.equal(5, 'last result passed through'); expect(call_order).to.eql([ @@ -35,11 +35,11 @@ describe('whilst', function(){ ); }); - it('whilst optional callback', function(done) { + it('whilst optional callback', (done) => { var counter = 0; async.whilst( - function () { return counter < 2; }, - function (cb) { + () => { return counter < 2; }, + (cb) => { counter++; cb(); } @@ -48,11 +48,11 @@ describe('whilst', function(){ done(); }); - it('whilst canceling', function(done) { + it('whilst canceling', (done) => { var counter = 0; async.whilst( - function () { return counter < 3; }, - function (cb) { + () => { return counter < 3; }, + (cb) => { counter++; cb(counter === 2 ? false : null); }, @@ -64,22 +64,22 @@ describe('whilst', function(){ }, 10) }); - it('doWhilst', function(done) { + it('doWhilst', (done) => { var call_order = []; var count = 0; async.doWhilst( - function (cb) { + (cb) => { call_order.push(['iteratee', count]); count++; cb(null, count); }, - function (c) { + (c) => { expect(c).to.equal(count); call_order.push(['test', count]); return (count < 5); }, - function (err, result) { + (err, result) => { assert(err === null, err + " passed instead of 'null'"); expect(result).to.equal(5, 'last result passed through'); expect(call_order).to.eql([ @@ -95,20 +95,20 @@ describe('whilst', function(){ ); }); - it('doWhilst callback params', function(done) { + it('doWhilst callback params', (done) => { var call_order = []; var count = 0; async.doWhilst( - function (cb) { + (cb) => { call_order.push(['iteratee', count]); count++; cb(null, count); }, - function (c) { + (c) => { call_order.push(['test', c]); return (c < 5); }, - function (err, result) { + (err, result) => { if (err) throw err; expect(result).to.equal(5, 'last result passed through'); expect(call_order).to.eql([ @@ -124,15 +124,15 @@ describe('whilst', function(){ ); }); - it('doWhilst - error', function(done) { + it('doWhilst - error', (done) => { var error = new Error('asdas'); async.doWhilst( - function (cb) { + (cb) => { cb(error); }, - function () {}, - function (err) { + () => {}, + (err) => { expect(err).to.equal(error); done(); } |