Skip to content

Commit 1dcfc65

Browse files
authored
test: improve internal/worker/io.js coverage
PR-URL: #42387 Refs: https://coverage.nodejs.org/coverage-6d3920d579a3dc3a/lib/internal/worker/io.js.html#L485 Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Akhil Marsonya <akhil.marsonya27@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Debadree Chatterjee <debadree333@gmail.com> Reviewed-By: Michael Dawson <midawson@redhat.com>
1 parent 7a33f2b commit 1dcfc65

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/parallel/test-worker-broadcastchannel.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const {
77
receiveMessageOnPort
88
} = require('worker_threads');
99
const assert = require('assert');
10+
const { inspect } = require('util');
1011

1112
assert.throws(() => new BroadcastChannel(Symbol('test')), {
1213
message: /Cannot convert a Symbol value to a string/
@@ -168,3 +169,17 @@ assert.throws(() => new BroadcastChannel(), {
168169
});
169170
});
170171
}
172+
173+
{
174+
const bc = new BroadcastChannel('channel5');
175+
assert.strictEqual(
176+
inspect(bc.ref()),
177+
"BroadcastChannel { name: 'channel5', active: true }"
178+
);
179+
180+
bc.close();
181+
assert.strictEqual(
182+
inspect(bc.ref()),
183+
"BroadcastChannel { name: 'channel5', active: false }"
184+
);
185+
}

0 commit comments

Comments
 (0)