You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
838 B

'use strict';
const common = require('../common');
const assert = require('assert');
const Transform = require('stream').Transform;
const _transform = common.mustCall(function _transform(d, e, n) {
n();
});
const _final = common.mustCall(function _final(n) {
n();
});
const _flush = common.mustCall(function _flush(n) {
n();
});
const t = new Transform({
transform: _transform,
flush: _flush,
final: _final
});
const t2 = new Transform({});
t.end(Buffer.from('blerg'));
t.resume();
common.expectsError(() => {
t2.end(Buffer.from('blerg'));
}, {
type: Error,
code: 'ERR_METHOD_NOT_IMPLEMENTED',
message: 'The _transform method is not implemented'
});
process.on('exit', () => {
assert.strictEqual(t._transform, _transform);
assert.strictEqual(t._flush, _flush);
assert.strictEqual(t._final, _final);
});