diff options
author | Benjamin Gruenbaum <benjamingr@gmail.com> | 2022-01-23 11:19:53 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-23 11:19:53 +0300 |
commit | ca489497bea4188e54d9b124467cd5145825fdae (patch) | |
tree | e37164c17d4bfc272e86c277f3bf3eff31452227 /test | |
parent | cc8931a91690e559fbbc323eb7c7436a575f922f (diff) |
stream: never flatten on toArray
PR-URL: https://github.com/nodejs/node/pull/41615
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-stream-toArray.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/test/parallel/test-stream-toArray.js b/test/parallel/test-stream-toArray.js index 4fcc77341fb..85e21edf97e 100644 --- a/test/parallel/test-stream-toArray.js +++ b/test/parallel/test-stream-toArray.js @@ -24,14 +24,16 @@ const assert = require('assert'); } { - // Works on a non-object-mode stream and flattens it + // Works on a non-object-mode stream (async () => { + const firstBuffer = Buffer.from([1, 2, 3]); + const secondBuffer = Buffer.from([4, 5, 6]); const stream = Readable.from( - [Buffer.from([1, 2, 3]), Buffer.from([4, 5, 6])] - , { objectMode: false }); + [firstBuffer, secondBuffer], + { objectMode: false }); const result = await stream.toArray(); - assert.strictEqual(Buffer.isBuffer(result), true); - assert.deepStrictEqual(Array.from(result), [1, 2, 3, 4, 5, 6]); + assert.strictEqual(Array.isArray(result), true); + assert.deepStrictEqual(result, [firstBuffer, secondBuffer]); })().then(common.mustCall()); } |