diff options
Diffstat (limited to 'test/parallel/test-stream3-cork-uncork.js')
-rw-r--r-- | test/parallel/test-stream3-cork-uncork.js | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/test/parallel/test-stream3-cork-uncork.js b/test/parallel/test-stream3-cork-uncork.js index 5b52ec0019..dfb901af41 100644 --- a/test/parallel/test-stream3-cork-uncork.js +++ b/test/parallel/test-stream3-cork-uncork.js @@ -17,15 +17,15 @@ let seenChunks = []; let seenEnd = false; const w = new Writable(); -// lets arrange to store the chunks +// Let's arrange to store the chunks. w._write = function(chunk, encoding, cb) { - // Default encoding given none was specified + // Default encoding given none was specified. assert.strictEqual(encoding, 'buffer'); seenChunks.push(chunk); cb(); }; -// lets record the stream end event +// Let's record the stream end event. w.on('finish', () => { seenEnd = true; }); @@ -37,7 +37,7 @@ function writeChunks(remainingChunks, callback) { if (writeChunk) { setImmediate(() => { writeState = w.write(writeChunk); - // we were not told to stop writing + // We were not told to stop writing. assert.ok(writeState); writeChunks(remainingChunks, callback); @@ -47,40 +47,40 @@ function writeChunks(remainingChunks, callback) { } } -// do an initial write +// Do an initial write. w.write('stuff'); -// the write was immediate +// The write was immediate. assert.strictEqual(seenChunks.length, 1); -// reset the chunks seen so far +// Reset the chunks seen so far. seenChunks = []; -// trigger stream buffering +// Trigger stream buffering. w.cork(); -// write the bufferedChunks +// Write the bufferedChunks. writeChunks(inputChunks, () => { - // should not have seen anything yet + // Should not have seen anything yet. assert.strictEqual(seenChunks.length, 0); - // trigger writing out the buffer + // Trigger writing out the buffer. w.uncork(); - // Buffered bytes should be seen in current tick + // Buffered bytes should be seen in current tick. assert.strictEqual(seenChunks.length, 4); - // did the chunks match + // Did the chunks match. for (let i = 0, l = expectedChunks.length; i < l; i++) { const seen = seenChunks[i]; - // there was a chunk + // There was a chunk. assert.ok(seen); const expected = Buffer.from(expectedChunks[i]); - // it was what we expected + // It was what we expected. assert.ok(seen.equals(expected)); } setImmediate(() => { - // the stream should not have been ended + // The stream should not have been ended. assert.ok(!seenEnd); }); }); |