diff options
author | Alexander Early <alexander.early@gmail.com> | 2018-09-02 17:37:34 -0700 |
---|---|---|
committer | Alexander Early <alexander.early@gmail.com> | 2018-09-02 17:37:34 -0700 |
commit | 94c411ce4af58ebda007d8dcb0956d5be19d78c5 (patch) | |
tree | 34cbcb259192ac4a0a3a137eaa253e8cd132f1a5 /test | |
parent | e5f01b89b95d781e63b988595727d143b494a566 (diff) | |
download | async-94c411ce4af58ebda007d8dcb0956d5be19d78c5.tar.gz |
awaitable reduce
Diffstat (limited to 'test')
-rw-r--r-- | test/es2017/awaitableFunctions.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/es2017/awaitableFunctions.js b/test/es2017/awaitableFunctions.js index 1656894..b51a23b 100644 --- a/test/es2017/awaitableFunctions.js +++ b/test/es2017/awaitableFunctions.js @@ -220,4 +220,18 @@ module.exports = function () { await async.mapValuesLimit(inputObj, 1, async (...args) => { calls.push(args) }); expect(calls).to.eql([[1, 'a'], [2, 'b'], [3, 'c']]) }); + + + it('should return a Promise: reduce', async () => { + expect (async.reduce.name).to.contain('reduce') + const calls = [] + await async.reduce(input, 1, async (...args) => calls.push(args)); + expect(calls).to.eql([[1, 1], [1, 2], [2, 3]]) + }); + it('should return a Promise: reduceRight', async () => { + expect (async.reduceRight.name).to.contain('reduceRight') + const calls = [] + await async.reduceRight(input, 1, async (...args) => calls.push(args)); + expect(calls).to.eql([[1, 3], [1, 2], [2, 1]]) + }); }; |