mirror of
https://github.com/nodejs/node.git
synced 2026-11-09 15:11:11 -05:00
Signed-off-by: Lazizbek Ergashev <lazerg2@gmail.com> PR-URL: https://github.com/nodejs/node/pull/65532 Fixes: https://github.com/nodejs/node/issues/65527 Reviewed-By: James M Snell <jasnell@gmail.com>
22 lines
860 B
JavaScript
22 lines
860 B
JavaScript
'use strict';
|
|
|
|
require('../common');
|
|
|
|
const assert = require('assert');
|
|
|
|
const classesToBeTested = [ MessageChannel, MessagePort, BroadcastChannel ];
|
|
|
|
classesToBeTested.forEach((cls) => {
|
|
assert.strictEqual(cls.prototype[Symbol.toStringTag], cls.name);
|
|
assert.deepStrictEqual(Object.getOwnPropertyDescriptor(cls.prototype, Symbol.toStringTag),
|
|
{ configurable: true, enumerable: false, value: cls.name, writable: false });
|
|
});
|
|
|
|
const channel = new MessageChannel();
|
|
assert.strictEqual(Object.prototype.toString.call(channel), '[object MessageChannel]');
|
|
assert.strictEqual(Object.prototype.toString.call(channel.port1), '[object MessagePort]');
|
|
|
|
const broadcastChannel = new BroadcastChannel('string-tag');
|
|
assert.strictEqual(Object.prototype.toString.call(broadcastChannel), '[object BroadcastChannel]');
|
|
broadcastChannel.close();
|