1'use strict'; 2const common = require('../common'); 3 4const assert = require('assert'); 5const { Transform } = require('stream'); 6 7const t = new Transform(); 8 9assert.throws( 10 () => { 11 t.end(Buffer.from('blerg')); 12 }, 13 { 14 name: 'Error', 15 code: 'ERR_METHOD_NOT_IMPLEMENTED', 16 message: 'The _transform() method is not implemented' 17 } 18); 19 20const _transform = common.mustCall((chunk, _, next) => { 21 next(); 22}); 23 24const _final = common.mustCall((next) => { 25 next(); 26}); 27 28const _flush = common.mustCall((next) => { 29 next(); 30}); 31 32const t2 = new Transform({ 33 transform: _transform, 34 flush: _flush, 35 final: _final 36}); 37 38assert.strictEqual(t2._transform, _transform); 39assert.strictEqual(t2._flush, _flush); 40assert.strictEqual(t2._final, _final); 41 42t2.end(Buffer.from('blerg')); 43t2.resume(); 44