diff options
author | Yoshiya Hinosawa <stibium121@gmail.com> | 2023-11-25 11:35:36 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-25 11:35:36 +0900 |
commit | 5710fffb120eba88e1b261e3ef379cb02575de42 (patch) | |
tree | 1e5fadbbba88bf816c124ed559082a5968adf1d3 /cli/tests/node_compat/test/parallel/test-stream2-transform.js | |
parent | 60b5d32d902deb46f640cbdb0d2d4caf47a437c4 (diff) |
chore: update node_compat test suites to v18.18.2 (#21328)
Diffstat (limited to 'cli/tests/node_compat/test/parallel/test-stream2-transform.js')
-rw-r--r-- | cli/tests/node_compat/test/parallel/test-stream2-transform.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/cli/tests/node_compat/test/parallel/test-stream2-transform.js b/cli/tests/node_compat/test/parallel/test-stream2-transform.js index c88a10d61..2bd376b1f 100644 --- a/cli/tests/node_compat/test/parallel/test-stream2-transform.js +++ b/cli/tests/node_compat/test/parallel/test-stream2-transform.js @@ -475,3 +475,27 @@ const { PassThrough, Transform } = require('stream'); assert.strictEqual(ended, true); })); } + +{ + const s = new Transform({ + objectMode: true, + construct(callback) { + this.push('header from constructor'); + callback(); + }, + transform: (row, encoding, callback) => { + callback(null, row); + }, + }); + + const expected = [ + 'header from constructor', + 'firstLine', + 'secondLine', + ]; + s.on('data', common.mustCall((data) => { + assert.strictEqual(data.toString(), expected.shift()); + }, 3)); + s.write('firstLine'); + process.nextTick(() => s.write('secondLine')); +} |