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
  • Loading branch information
edsadr committed Jan 12, 2017
1 parent d3eca02 commit 73a2007
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
Original file line number Diff line number Diff line change
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 73a2007

Please sign in to comment.