diff options
author | Juan José <soyjuanarbol@gmail.com> | 2022-11-01 23:15:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-01 23:15:41 +0300 |
commit | 74d214761c9227108ff5b60bfd92cc6232678a82 (patch) | |
tree | a6856507b6aba22fec47ad64fffdce5aaf2c45b7 | |
parent | 5e74cb60767b23f028ec4a06fbf293f9a8120e44 (diff) |
test: make `test-eventemitter-asyncresource.js` shorter
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/45146
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
-rw-r--r-- | test/parallel/test-eventemitter-asyncresource.js | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/test/parallel/test-eventemitter-asyncresource.js b/test/parallel/test-eventemitter-asyncresource.js index 4cd2bc69207..8290cdee1f2 100644 --- a/test/parallel/test-eventemitter-asyncresource.js +++ b/test/parallel/test-eventemitter-asyncresource.js @@ -143,17 +143,14 @@ throws( { code: 'ERR_INVALID_THIS' } ); -throws( - () => Reflect.get(EventEmitterAsyncResource.prototype, 'asyncId', {}), - { code: 'ERR_INVALID_THIS' } -); - -throws( - () => Reflect.get(EventEmitterAsyncResource.prototype, 'triggerAsyncId', {}), - { code: 'ERR_INVALID_THIS' } -); - -throws( - () => Reflect.get(EventEmitterAsyncResource.prototype, 'asyncResource', {}), - { code: 'ERR_INVALID_THIS' } -); +['asyncId', 'triggerAsyncId', 'asyncResource'].forEach((getter) => { + throws( + () => Reflect.get(EventEmitterAsyncResource.prototype, getter, {}), + { + code: 'ERR_INVALID_THIS', + name: /TypeError/, + message: 'Value of "this" must be of type EventEmitterAsyncResource', + stack: new RegExp(`at get ${getter}`) + } + ); +}); |