-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: improve test coverage of internal/worker/io
PR-URL: #41511 Refs: https://coverage.nodejs.org/coverage-74b9baa4265a8f0d/lib/internal/worker/io.js.html#L415 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
- Loading branch information
1 parent
5943cb9
commit 506a0dd
Showing
1 changed file
with
40 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
'use strict'; | ||
|
||
require('../common'); | ||
const { BroadcastChannel } = require('worker_threads'); | ||
const { inspect } = require('util'); | ||
const assert = require('assert'); | ||
|
||
// This test checks BroadcastChannel custom inspect outputs | ||
|
||
{ | ||
const bc = new BroadcastChannel('name'); | ||
assert.throws(() => bc[inspect.custom].call(), { | ||
code: 'ERR_INVALID_THIS', | ||
}); | ||
bc.close(); | ||
} | ||
|
||
{ | ||
const bc = new BroadcastChannel('name'); | ||
assert.strictEqual(inspect(bc, { depth: -1 }), 'BroadcastChannel'); | ||
bc.close(); | ||
} | ||
|
||
{ | ||
const bc = new BroadcastChannel('name'); | ||
assert.strictEqual( | ||
inspect(bc), | ||
"BroadcastChannel { name: 'name', active: true }" | ||
); | ||
bc.close(); | ||
} | ||
|
||
{ | ||
const bc = new BroadcastChannel('name'); | ||
assert.strictEqual( | ||
inspect(bc, { depth: null }), | ||
"BroadcastChannel { name: 'name', active: true }" | ||
); | ||
bc.close(); | ||
} |