test: test-async-wrap-constructor prefer forEach
PR-URL: https://github.com/nodejs/node/pull/32631 Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
This commit is contained in:
parent
3140fdcd34
commit
e99ec39610
@ -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`
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user