test: add test to once() in event lib

This test verify if eventEmmiter param is right

PR-URL: https://github.com/nodejs/node/pull/46126
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
This commit is contained in:
Jonathan Diaz authored and Juan José Arboleda committed 2023-01-31 08:04:16 -05:00
1 parent 2497702b82
commit 40d52fbc5f
1 file changed
+8
+8
View File
@@ -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(),