Skip to content

Commit c6618df

Browse files
edsadritaloacasas
authored andcommitted
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: #10699 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent c217b43 commit c6618df

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

test/parallel/test-stream-transform-constructor-set-methods.js

+10-3
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,19 @@ const t = new Transform({
2121
flush: _flush
2222
});
2323

24+
const t2 = new Transform({});
25+
2426
t.end(Buffer.from('blerg'));
2527
t.resume();
2628

27-
process.on('exit', function() {
29+
assert.throws(() => {
30+
t2.end(Buffer.from('blerg'));
31+
}, /^Error: _transform\(\) is not implemented$/);
32+
33+
34+
process.on('exit', () => {
2835
assert.strictEqual(t._transform, _transform);
2936
assert.strictEqual(t._flush, _flush);
30-
assert(_transformCalled);
31-
assert(_flushCalled);
37+
assert.strictEqual(_transformCalled, true);
38+
assert.strictEqual(_flushCalled, true);
3239
});

0 commit comments

Comments
 (0)