From ff41173600a751eea0e310e2f30515ed58e03a7b Mon Sep 17 00:00:00 2001 From: Yoshiki Kurihara Date: Fri, 18 Mar 2022 13:46:39 +0900 Subject: [PATCH] test: improve internal/worker/io.js coverage --- test/parallel/test-worker-broadcastchannel.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/test/parallel/test-worker-broadcastchannel.js b/test/parallel/test-worker-broadcastchannel.js index 8e588994aab666..12535271c15596 100644 --- a/test/parallel/test-worker-broadcastchannel.js +++ b/test/parallel/test-worker-broadcastchannel.js @@ -7,6 +7,7 @@ const { receiveMessageOnPort } = require('worker_threads'); const assert = require('assert'); +const { inspect } = require('util'); assert.throws(() => new BroadcastChannel(Symbol('test')), { message: /Cannot convert a Symbol value to a string/ @@ -168,3 +169,17 @@ assert.throws(() => new BroadcastChannel(), { }); }); } + +{ + const bc = new BroadcastChannel('channel5'); + assert.strictEqual( + inspect(bc.ref()), + "BroadcastChannel { name: 'channel5', active: true }" + ); + + bc.close(); + assert.strictEqual( + inspect(bc.ref()), + "BroadcastChannel { name: 'channel5', active: false }" + ); +}