11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst common = require('../common'); 41cb0ef41Sopenharmony_ciconst stream = require('stream'); 51cb0ef41Sopenharmony_ciconst assert = require('assert'); 61cb0ef41Sopenharmony_ci 71cb0ef41Sopenharmony_ciconst transform = new stream.Transform({ 81cb0ef41Sopenharmony_ci transform: _transform, 91cb0ef41Sopenharmony_ci highWaterMark: 1 101cb0ef41Sopenharmony_ci}); 111cb0ef41Sopenharmony_ci 121cb0ef41Sopenharmony_cifunction _transform(chunk, encoding, cb) { 131cb0ef41Sopenharmony_ci process.nextTick(() => { 141cb0ef41Sopenharmony_ci assert.strictEqual(transform._writableState.needDrain, true); 151cb0ef41Sopenharmony_ci cb(); 161cb0ef41Sopenharmony_ci }); 171cb0ef41Sopenharmony_ci} 181cb0ef41Sopenharmony_ci 191cb0ef41Sopenharmony_ciassert.strictEqual(transform._writableState.needDrain, false); 201cb0ef41Sopenharmony_ci 211cb0ef41Sopenharmony_citransform.write('asdasd', common.mustCall(() => { 221cb0ef41Sopenharmony_ci assert.strictEqual(transform._writableState.needDrain, false); 231cb0ef41Sopenharmony_ci})); 241cb0ef41Sopenharmony_ci 251cb0ef41Sopenharmony_ciassert.strictEqual(transform._writableState.needDrain, true); 26