Skip to content

Commit

Permalink
test: duplicated buffer in test-stream2-writable.js
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
duvanmonsa authored and targos committed Jul 2, 2019
1 parent 91d5a4d commit 16926a8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/parallel/test-stream2-writable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

{
Expand All @@ -244,15 +246,15 @@ 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());
}

{
// 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() {
Expand Down

0 comments on commit 16926a8

Please sign in to comment.