0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 07:27:22 +01:00

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>
This commit is contained in:
Rich Trott 2017-06-20 09:56:05 -07:00
parent 3b0e800f18
commit f833e25170

View File

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