29 lines
1.1 KiB
Diff
29 lines
1.1 KiB
Diff
|
Index: node-v18.13.0/test/parallel/test-whatwg-webstreams-compression.js
|
||
|
===================================================================
|
||
|
--- node-v18.13.0.orig/test/parallel/test-whatwg-webstreams-compression.js
|
||
|
+++ node-v18.13.0/test/parallel/test-whatwg-webstreams-compression.js
|
||
|
@@ -20,11 +20,19 @@ async function test(format) {
|
||
|
const reader = gunzip.readable.getReader();
|
||
|
const writer = gzip.writable.getWriter();
|
||
|
|
||
|
+ let compressed_data = [];
|
||
|
+ const reader_function = ({ value, done }) => {
|
||
|
+ if (value)
|
||
|
+ compressed_data.push(value);
|
||
|
+ if (!done)
|
||
|
+ return reader.read().then(reader_function);
|
||
|
+ assert.strictEqual(dec.decode(Buffer.concat(compressed_data)), 'hello');
|
||
|
+ };
|
||
|
+ const reader_promise = reader.read().then(reader_function);
|
||
|
+
|
||
|
await Promise.all([
|
||
|
- reader.read().then(({ value, done }) => {
|
||
|
- assert.strictEqual(dec.decode(value), 'hello');
|
||
|
- }),
|
||
|
- reader.read().then(({ done }) => assert(done)),
|
||
|
+ reader_promise,
|
||
|
+ reader_promise.then(() => reader.read().then(({ done }) => assert(done))),
|
||
|
writer.write('hello'),
|
||
|
writer.close(),
|
||
|
]);
|