From 16926a818385f2f1c84ace33c750d0a33789b228 Mon Sep 17 00:00:00 2001 From: Duvan Monsalve Date: Fri, 21 Jun 2019 22:41:40 -0500 Subject: [PATCH] test: duplicated buffer in test-stream2-writable.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/28380 Reviewed-By: Anna Henningsen Reviewed-By: Adrian Estrada Reviewed-By: Yongsheng Zhang Reviewed-By: Gireesh Punathil Reviewed-By: Michaƫl Zasso Reviewed-By: Colin Ihrig Reviewed-By: Ruben Bridgewater Reviewed-By: Trivikram Kamat Reviewed-By: James M Snell Reviewed-By: Rich Trott --- test/parallel/test-stream2-writable.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-stream2-writable.js b/test/parallel/test-stream2-writable.js index 7c5f825a575d69..262606d9062a10 100644 --- a/test/parallel/test-stream2-writable.js +++ b/test/parallel/test-stream2-writable.js @@ -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() {