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:
Adrian Estrada authored and Italo A. Casas committed 2017-01-30 12:08:42 -05:00
1 parent c217b438f2
commit c6618df2cc
1 file changed
+10 -3
@@ -21,12 +21,19 @@ const t = new Transform({
flush: _flush
});
const t2 = new Transform({});
t.end(Buffer.from('blerg'));
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._flush, _flush);
assert(_transformCalled);
assert(_flushCalled);
assert.strictEqual(_transformCalled, true);
assert.strictEqual(_flushCalled, true);
});