mirror of
https://github.com/nodejs/node.git
synced 2026-11-29 14:27:57 -05:00
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:
1 parent
1a2b3eb3a4
commit
b4ef06267d
1 file changed
+5
-4
@@ -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`
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user