From 832159bf404b1081d211fc62ddafd6ac207b639b Mon Sep 17 00:00:00 2001 From: Alexander Early Date: Sun, 5 Aug 2018 16:51:40 -0700 Subject: check errors --- test/es2017/awaitableFunctions.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/es2017/awaitableFunctions.js b/test/es2017/awaitableFunctions.js index 82c489f..fc866fa 100644 --- a/test/es2017/awaitableFunctions.js +++ b/test/es2017/awaitableFunctions.js @@ -19,6 +19,23 @@ module.exports = function () { expect(sameStack).to.equal(true) }) + it('should throw as expected (async)', async () => { + try { + await async.each(input, async val => { throw new Error(val) }); + } catch (e) { + var thrown = e + } + expect(thrown).to.be.an('error') + }); + + it('should throw as expected (callback)', async () => { + try { + await async.each(input, (val, cb) => { cb(new Error(val)) }); + } catch (e) { + var thrown = e + } + expect(thrown).to.be.an('error') + }); /* * Collections -- cgit v1.2.1