Skip to content

Commit

Permalink
test: add test to once() in event lib
Browse files Browse the repository at this point in the history
This test verify if eventEmmiter param is right

PR-URL: #46126
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
  • Loading branch information
jdiaz-dev authored and RafaelGSS committed Jan 20, 2023
1 parent 69aafc3 commit 0f60bc9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/parallel/test-events-once.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ async function onceWithEventTargetError() {
strictEqual(err, error);
}

async function onceWithInvalidEventEmmiter() {
const ac = new AbortController();
return rejects(once(ac, 'myevent'), {
code: 'ERR_INVALID_ARG_TYPE',
});
}

async function prioritizesEventEmitter() {
const ee = new EventEmitter();
ee.addEventListener = fail;
Expand Down Expand Up @@ -256,6 +263,7 @@ Promise.all([
onceError(),
onceWithEventTarget(),
onceWithEventTargetError(),
onceWithInvalidEventEmmiter(),
prioritizesEventEmitter(),
abortSignalBefore(),
abortSignalAfter(),
Expand Down

0 comments on commit 0f60bc9

Please sign in to comment.