Skip to content

Commit b549e10

Browse files
alexweejaduh95
authored andcommitted
Async (again)
1 parent 037f876 commit b549e10

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

test/parallel/test-eventtarget-once-twice.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,21 @@ const { once } = require('node:events');
55
const { test } = require('node:test');
66
const { setImmediate } = require('node:timers/promises');
77

8-
test('should resolve `once` twice', (t, done) => {
8+
test('should resolve `once` twice', async () => {
99

1010
const et = new EventTarget();
1111

12-
(async () => {
13-
await once(et, 'foo');
14-
await once(et, 'foo');
15-
done();
16-
})(common.mustCall());
12+
await Promise.all([
13+
(async () => {
14+
await once(et, 'foo');
15+
await once(et, 'foo');
16+
})(),
1717

18-
(async () => {
19-
et.dispatchEvent(new Event('foo'));
20-
await setImmediate();
21-
et.dispatchEvent(new Event('foo'));
22-
})(common.mustCall());
18+
(async () => {
19+
et.dispatchEvent(new Event('foo'));
20+
await setImmediate();
21+
et.dispatchEvent(new Event('foo'));
22+
})()
23+
]);
2324

2425
});

0 commit comments

Comments
 (0)