test: improve test-worker-message-port-message-before-close

Replace a wrong comment with a correct assertion and await all async
operations inside the async function.

PR-URL: https://github.com/nodejs/node/pull/29483
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Anna Henningsen authored and Ruben Bridgewater committed 2019-09-25 18:20:48 +02:00
1 parent 53f23715df
commit 79a277ed10
1 file changed
+2 -2
@@ -28,11 +28,11 @@ async function test() {
for (let i = 0; i < 10000; i++) {
const { port1, port2 } = new MessageChannel();
worker.postMessage({ port: port2 }, [ port2 ]);
await once(port1, 'message'); // 'complexObject'
assert.deepStrictEqual(await once(port1, 'message'), ['firstMessage']);
assert.deepStrictEqual(await once(port1, 'message'), ['lastMessage']);
}
worker.terminate();
await worker.terminate();
}
test().then(common.mustCall());