Skip to content

Commit

Permalink
test: improve test stream transform constructor
Browse files Browse the repository at this point in the history
* 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 <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information
edsadr authored and jasnell committed Jan 12, 2017
1 parent 74fb8a2 commit 537d7bd
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions test/parallel/test-stream-transform-constructor-set-methods.js
Expand Up @@ -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);
});

0 comments on commit 537d7bd

Please sign in to comment.