diff options
author | Alexander Early <alexander.early@gmail.com> | 2018-08-05 16:51:40 -0700 |
---|---|---|
committer | Alexander Early <alexander.early@gmail.com> | 2018-08-05 16:51:40 -0700 |
commit | 832159bf404b1081d211fc62ddafd6ac207b639b (patch) | |
tree | c1e3524294c3680015816b4df4b4b2e808335eee | |
parent | 309dae64a3859fc31521e38aaf041f3eee33e126 (diff) | |
download | async-832159bf404b1081d211fc62ddafd6ac207b639b.tar.gz |
check errors
-rw-r--r-- | test/es2017/awaitableFunctions.js | 17 |
1 files changed, 17 insertions, 0 deletions
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 |