Skip to content

Commit

Permalink
test: replace forEach() with for .. of
Browse files Browse the repository at this point in the history
PR-URL: #50605
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
bliakher authored and UlisesGascon committed Dec 11, 2023
1 parent 9397b2d commit 7b9b1fb
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions test/parallel/test-async-wrap-constructor.js
Expand Up @@ -6,15 +6,16 @@ require('../common');
const assert = require('assert');
const async_hooks = require('async_hooks');

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

0 comments on commit 7b9b1fb

Please sign in to comment.