node/test/parallel/test-compression-decompression-stream.js
Mert Can Altin cd155d6454
stream: fix util.inspect for compression/decompressionStream
PR-URL: https://github.com/nodejs/node/pull/52283
Fixes: https://github.com/nodejs/node/issues/52263
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
Reviewed-By: Matthew Aitken <maitken033380023@gmail.com>
Reviewed-By: Filip Skokan <panva.ip@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Deokjin Kim <deokjin81.kim@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
2024-05-12 09:38:40 +02:00

42 lines
1.2 KiB
JavaScript

// Flags: --no-warnings --expose-internals
'use strict';
require('../common');
const assert = require('node:assert');
const { describe, it } = require('node:test');
const {
CompressionStream,
DecompressionStream,
} = require('node:stream/web');
const {
customInspectSymbol: kInspect,
} = require('internal/util');
describe('DecompressionStream kInspect method', () => {
it('should return a predictable inspection string with DecompressionStream', () => {
const decompressionStream = new DecompressionStream('deflate');
const depth = 1;
const options = {};
const actual = decompressionStream[kInspect](depth, options);
assert(actual.includes('DecompressionStream'));
assert(actual.includes('ReadableStream'));
assert(actual.includes('WritableStream'));
});
});
describe('CompressionStream kInspect method', () => {
it('should return a predictable inspection string with CompressionStream', () => {
const compressionStream = new CompressionStream('deflate');
const depth = 1;
const options = {};
const actual = compressionStream[kInspect](depth, options);
assert(actual.includes('CompressionStream'));
assert(actual.includes('ReadableStream'));
assert(actual.includes('WritableStream'));
});
});