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 juanarbol committed Jan 31, 2023
1 parent 2497702 commit 40d52fb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/parallel/test-events-once.js
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 40d52fb

Please sign in to comment.