11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_cirequire('../common');
41cb0ef41Sopenharmony_ciconst { BroadcastChannel } = require('worker_threads');
51cb0ef41Sopenharmony_ciconst { inspect } = require('util');
61cb0ef41Sopenharmony_ciconst assert = require('assert');
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ci// This test checks BroadcastChannel custom inspect outputs
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_ci{
111cb0ef41Sopenharmony_ci  const bc = new BroadcastChannel('name');
121cb0ef41Sopenharmony_ci  assert.throws(() => bc[inspect.custom].call(), {
131cb0ef41Sopenharmony_ci    code: 'ERR_INVALID_THIS',
141cb0ef41Sopenharmony_ci  });
151cb0ef41Sopenharmony_ci  bc.close();
161cb0ef41Sopenharmony_ci}
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_ci{
191cb0ef41Sopenharmony_ci  const bc = new BroadcastChannel('name');
201cb0ef41Sopenharmony_ci  assert.strictEqual(inspect(bc, { depth: -1 }), 'BroadcastChannel');
211cb0ef41Sopenharmony_ci  bc.close();
221cb0ef41Sopenharmony_ci}
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_ci{
251cb0ef41Sopenharmony_ci  const bc = new BroadcastChannel('name');
261cb0ef41Sopenharmony_ci  assert.strictEqual(
271cb0ef41Sopenharmony_ci    inspect(bc),
281cb0ef41Sopenharmony_ci    "BroadcastChannel { name: 'name', active: true }"
291cb0ef41Sopenharmony_ci  );
301cb0ef41Sopenharmony_ci  bc.close();
311cb0ef41Sopenharmony_ci}
321cb0ef41Sopenharmony_ci
331cb0ef41Sopenharmony_ci{
341cb0ef41Sopenharmony_ci  const bc = new BroadcastChannel('name');
351cb0ef41Sopenharmony_ci  assert.strictEqual(
361cb0ef41Sopenharmony_ci    inspect(bc, { depth: null }),
371cb0ef41Sopenharmony_ci    "BroadcastChannel { name: 'name', active: true }"
381cb0ef41Sopenharmony_ci  );
391cb0ef41Sopenharmony_ci  bc.close();
401cb0ef41Sopenharmony_ci}
41