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 <[email protected]>
PR-URL: #45146
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Gerhard Stöbich <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
juanarbol authored and RafaelGSS committed Nov 10, 2022
1 parent 5d48011 commit d5f4d98
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 d5f4d98

Please sign in to comment.