Skip to content

Commit 2d523a1

Browse files
committed
test: cover data listener added after pipe
1 parent aada36c commit 2d523a1

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

test/parallel/test-stream2-basic.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,27 @@ class TestWriter extends EE {
192192
assert.deepStrictEqual(events, ['data', 'write']);
193193
}));
194194
}
195+
196+
{
197+
const events = [];
198+
const r = R.from(['a', 'b']);
199+
const w = new W({
200+
write(chunk, enc, cb) {
201+
events.push(`write:${chunk}`);
202+
if (String(chunk) === 'a') {
203+
r.on('data', common.mustCall((chunk) => {
204+
events.push(`data:${chunk}`);
205+
}));
206+
}
207+
cb();
208+
},
209+
});
210+
211+
r.pipe(w);
212+
w.on('finish', common.mustCall(() => {
213+
assert.deepStrictEqual(events, ['write:a', 'write:b', 'data:b']);
214+
}));
215+
}
195216
}
196217

197218

0 commit comments

Comments
 (0)