Skip to content

Commit

Permalink
test: refactor test-stream2-writable
Browse files Browse the repository at this point in the history
* Use common.mustCall() to confirm that _write() is called only once.
* Check that _write() is called with the correct argument

PR-URL: #13823
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
  • Loading branch information
Trott committed Jun 23, 2017
1 parent 3b0e800 commit f833e25
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/parallel/test-stream2-writable.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,9 @@ for (let i = 0; i < chunks.length; i++) {
{
// Verify that end(chunk) twice is an error
const w = new W();
w._write = common.noop;
w._write = common.mustCall((msg) => {
assert.strictEqual(msg.toString(), 'this is the end');
});
let gotError = false;
w.on('error', function(er) {
gotError = true;
Expand Down

0 comments on commit f833e25

Please sign in to comment.