Browse Source

test: refactor test-stream2-writable

* Use common.mustCall() to confirm that _write() is called only once.
* Check that _write() is called with the correct argument

PR-URL: https://github.com/nodejs/node/pull/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>
v6
Rich Trott 8 years ago
parent
commit
f833e25170
  1. 4
      test/parallel/test-stream2-writable.js

4
test/parallel/test-stream2-writable.js

@ -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;

Loading…
Cancel
Save