Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: improve test stream transform constructor #10699

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
  • Loading branch information
edsadr committed Jan 12, 2017
commit 73a200701f244493a27bb7fecfe03a62ca9c3619
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);
});