mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
5ef83bab6f
PR-URL: https://github.com/nodejs/node/pull/42747 Refs: https://coverage.nodejs.org/coverage-24adba675179ebba/lib/internal/webstreams/encoding.js.html#L98 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Mestery <mestery@protonmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
36 lines
1.0 KiB
JavaScript
36 lines
1.0 KiB
JavaScript
'use strict';
|
|
|
|
require('../common');
|
|
|
|
const { TextEncoderStream, TextDecoderStream } = require('stream/web');
|
|
const util = require('util');
|
|
const assert = require('assert');
|
|
|
|
const textEncoderStream = new TextEncoderStream();
|
|
assert.strictEqual(
|
|
util.inspect(textEncoderStream),
|
|
`TextEncoderStream {
|
|
encoding: 'utf-8',
|
|
readable: ReadableStream { locked: false, state: 'readable', supportsBYOB: false },
|
|
writable: WritableStream { locked: false, state: 'writable' }
|
|
}`
|
|
);
|
|
assert.throws(() => textEncoderStream[util.inspect.custom].call(), {
|
|
code: 'ERR_INVALID_THIS',
|
|
});
|
|
|
|
const textDecoderStream = new TextDecoderStream();
|
|
assert.strictEqual(
|
|
util.inspect(textDecoderStream),
|
|
`TextDecoderStream {
|
|
encoding: 'utf-8',
|
|
fatal: false,
|
|
ignoreBOM: false,
|
|
readable: ReadableStream { locked: false, state: 'readable', supportsBYOB: false },
|
|
writable: WritableStream { locked: false, state: 'writable' }
|
|
}`
|
|
);
|
|
assert.throws(() => textDecoderStream[util.inspect.custom].call(), {
|
|
code: 'ERR_INVALID_THIS',
|
|
});
|