test: improve test stream transform constructor
* new test for the error when a transform function is not specified * use let instead of var * use assert.strictEqual instead of assert.equal * use arrow functions PR-URL: https://github.com/nodejs/node/pull/10699 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
74fb8a2948
commit
537d7bd936
@ -21,12 +21,19 @@ const t = new Transform({
|
|||||||
flush: _flush
|
flush: _flush
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const t2 = new Transform({});
|
||||||
|
|
||||||
t.end(Buffer.from('blerg'));
|
t.end(Buffer.from('blerg'));
|
||||||
t.resume();
|
t.resume();
|
||||||
|
|
||||||
process.on('exit', function() {
|
assert.throws(() => {
|
||||||
|
t2.end(Buffer.from('blerg'));
|
||||||
|
}, /^Error: _transform\(\) is not implemented$/);
|
||||||
|
|
||||||
|
|
||||||
|
process.on('exit', () => {
|
||||||
assert.strictEqual(t._transform, _transform);
|
assert.strictEqual(t._transform, _transform);
|
||||||
assert.strictEqual(t._flush, _flush);
|
assert.strictEqual(t._flush, _flush);
|
||||||
assert(_transformCalled);
|
assert.strictEqual(_transformCalled, true);
|
||||||
assert(_flushCalled);
|
assert.strictEqual(_flushCalled, true);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user