From 73a200701f244493a27bb7fecfe03a62ca9c3619 Mon Sep 17 00:00:00 2001 From: Adrian Estrada Date: Sun, 8 Jan 2017 22:36:59 -0500 Subject: [PATCH] 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 --- ...test-stream-transform-constructor-set-methods.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-stream-transform-constructor-set-methods.js b/test/parallel/test-stream-transform-constructor-set-methods.js index 02ef9f55cb4460..1423f4de10942d 100644 --- a/test/parallel/test-stream-transform-constructor-set-methods.js +++ b/test/parallel/test-stream-transform-constructor-set-methods.js @@ -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); });