Skip to content

Commit d791f39

Browse files
test: simplify round-trip test using Array.fromAsync
1 parent aa1901c commit d791f39

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

test/parallel/test-webstreams-compression-buffer-source.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ test('CompressionStream round-trip with ArrayBuffer input', async () => {
2828
const ds = new DecompressionStream('gzip');
2929

3030
const csWriter = cs.writable.getWriter();
31-
const dsReader = ds.readable.getReader();
3231

3332
const input = new TextEncoder().encode('hello').buffer;
3433

@@ -37,13 +36,7 @@ test('CompressionStream round-trip with ArrayBuffer input', async () => {
3736

3837
await cs.readable.pipeTo(ds.writable);
3938

40-
const out = [];
41-
let done = false;
42-
while (!done) {
43-
const { value, done: d } = await dsReader.read();
44-
if (value) out.push(value);
45-
done = d;
46-
}
39+
const out = await Array.fromAsync(ds.readable);
4740
const result = Buffer.concat(out.map((c) => Buffer.from(c)));
4841
assert.strictEqual(result.toString(), 'hello');
4942
});

0 commit comments

Comments
 (0)