node/test/parallel/test-webstream-string-tag.js
Jithil P Ponnan e9ba08e116
stream: fix web streams have no Symbol.toStringTag
stream: fix web streams have no Symbol.toStringTag

stream: add unit tests
PR-URL: https://github.com/nodejs/node/pull/45117
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2022-10-26 15:48:48 +00:00

19 lines
859 B
JavaScript

'use strict';
require('../common');
const assert = require('assert');
const classesToBeTested = [ WritableStream, WritableStreamDefaultWriter, WritableStreamDefaultController,
ReadableStream, ReadableStreamBYOBRequest, ReadableStreamDefaultReader,
ReadableStreamBYOBReader, ReadableStreamDefaultController, ReadableByteStreamController,
ByteLengthQueuingStrategy, CountQueuingStrategy, TransformStream,
TransformStreamDefaultController];
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 });
});