From 7b63f3275ef3be36ddc1ed28dad9e3347bd6fc06 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 --- 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() {