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>
jdiaz-dev authored and RafaelGSS committed Jan 20, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
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
@@ -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;
@@ -256,6 +263,7 @@ Promise.all([
onceError(),
onceWithEventTarget(),
onceWithEventTargetError(),
onceWithInvalidEventEmmiter(),
prioritizesEventEmitter(),
abortSignalBefore(),
abortSignalAfter(),

0 comments on commit 0f60bc9

Please sign in to comment.