test: duplicated buffer in test-stream2-writable.js

PR-URL: https://github.com/nodejs/node/pull/28380
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Adrian Estrada <edsadr@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
Duvan Monsalve 2019-06-21 22:41:40 -05:00 committed by Rich Trott
parent 88db3e431f
commit c42da5ed29

View File

@ -229,10 +229,12 @@ for (let i = 0; i < chunks.length; i++) {
tw.end(common.mustCall());
}
const helloWorldBuffer = Buffer.from('hello world');
{
// Verify end() callback with chunk
const tw = new TestWriter();
tw.end(Buffer.from('hello world'), common.mustCall());
tw.end(helloWorldBuffer, common.mustCall());
}
{
@ -244,7 +246,7 @@ for (let i = 0; i < chunks.length; i++) {
{
// Verify end() callback after write() call
const tw = new TestWriter();
tw.write(Buffer.from('hello world'));
tw.write(helloWorldBuffer);
tw.end(common.mustCall());
}
@ -252,7 +254,7 @@ for (let i = 0; i < chunks.length; i++) {
// Verify end() callback after write() callback
const tw = new TestWriter();
let writeCalledback = false;
tw.write(Buffer.from('hello world'), function() {
tw.write(helloWorldBuffer, function() {
writeCalledback = true;
});
tw.end(common.mustCall(function() {