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]>
  • Loading branch information
juanarbol committed Oct 28, 2022
1 parent aab9f32 commit c27bb19
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 c27bb19

Please sign in to comment.