Skip to content

Commit

Permalink
test: make test-eventemitter-asyncresource.js shorter
Browse files Browse the repository at this point in the history
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
PR-URL: #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>
  • Loading branch information
juanarbol authored and danielleadams committed Jan 3, 2023
1 parent e05ebe8 commit ab9c2df
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions test/parallel/test-eventemitter-asyncresource.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
}
);
});

0 comments on commit ab9c2df

Please sign in to comment.