summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Early <alexander.early@gmail.com>2018-08-05 16:51:40 -0700
committerAlexander Early <alexander.early@gmail.com>2018-08-05 16:51:40 -0700
commit832159bf404b1081d211fc62ddafd6ac207b639b (patch)
treec1e3524294c3680015816b4df4b4b2e808335eee
parent309dae64a3859fc31521e38aaf041f3eee33e126 (diff)
downloadasync-832159bf404b1081d211fc62ddafd6ac207b639b.tar.gz
check errors
-rw-r--r--test/es2017/awaitableFunctions.js17
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