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