mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
826b7533e8
PR-URL: https://github.com/nodejs/node/pull/54609 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
23 lines
771 B
JavaScript
23 lines
771 B
JavaScript
'use strict';
|
|
|
|
require('../common');
|
|
|
|
const assert = require('node:assert');
|
|
const zlib = require('node:zlib');
|
|
const { test } = require('node:test');
|
|
|
|
// Regression test for https://github.com/nodejs/node/issues/30976
|
|
test('Writes to a stream should finish even after the readable side has been ended.', async (t) => {
|
|
const { promise, resolve } = Promise.withResolvers();
|
|
const data = zlib.deflateRawSync('Welcome');
|
|
const inflate = zlib.createInflateRaw();
|
|
const writeCallback = t.mock.fn();
|
|
inflate.resume();
|
|
inflate.write(data, writeCallback);
|
|
inflate.write(Buffer.from([0x00]), writeCallback);
|
|
inflate.write(Buffer.from([0x00]), writeCallback);
|
|
inflate.flush(resolve);
|
|
await promise;
|
|
assert.strictEqual(writeCallback.mock.callCount(), 3);
|
|
});
|