Skip to content

Commit

Permalink
test: test-async-wrap-constructor prefer forEach
Browse files Browse the repository at this point in the history
PR-URL: #32631
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
  • Loading branch information
dericop authored and BethGriggs committed Apr 28, 2020
1 parent 1a2b3eb commit b4ef062
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/parallel/test-async-wrap-constructor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ require('../common');
const assert = require('assert');
const async_hooks = require('async_hooks');

for (const badArg of [0, 1, false, true, null, 'hello']) {
[0, 1, false, true, null, 'hello'].forEach((badArg) => {
const hookNames = ['init', 'before', 'after', 'destroy', 'promiseResolve'];
for (const field of hookNames) {
hookNames.forEach((field) => {
assert.throws(() => {
async_hooks.createHook({ [field]: badArg });
}, {
code: 'ERR_ASYNC_CALLBACK',
name: 'TypeError',
message: `hook.${field} must be a function`
});
}
}
});
});

0 comments on commit b4ef062

Please sign in to comment.