1'use strict'; 2 3// Regression test for https://github.com/nodejs/node/issues/14523. 4// Checks that flushes interact properly with writableState.needDrain, 5// even if no flush callback was passed. 6 7const common = require('../common'); 8const assert = require('assert'); 9const zlib = require('zlib'); 10 11const zipper = zlib.createGzip({ highWaterMark: 16384 }); 12const unzipper = zlib.createGunzip(); 13zipper.pipe(unzipper); 14 15zipper.write('A'.repeat(17000)); 16zipper.flush(); 17 18let received = 0; 19unzipper.on('data', common.mustCall((d) => { 20 received += d.length; 21}, 2)); 22 23// Properly `.end()`ing the streams would interfere with checking that 24// `.flush()` works. 25process.on('exit', () => { 26 assert.strictEqual(received, 17000); 27}); 28