mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
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:
1 parent
2497702b82
commit
40d52fbc5f
1 file changed
+8
@@ -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(),
|
||||
|
||||
Reference in new issue
Block a user