Skip to content

Commit 9405cdd

Browse files
lpincacodebytere
authored andcommitted
test: improve test-stream-duplex-readable-end
- Remove unneeded listener for the `'error'` event. - Use `common.mustCall()`. - Verify that the `src` stream gets paused. PR-URL: #36056 Refs: #35941 Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Ricky Zhou <0x19951125@gmail.com>
1 parent 1550073 commit 9405cdd

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

‎test/parallel/test-stream-duplex-readable-end.js‎

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict';
22
// https://github.com/nodejs/node/issues/35926
3-
require('../common');
3+
constcommon=require('../common');
44
constassert=require('assert');
55
conststream=require('stream');
66

@@ -22,11 +22,8 @@ const dst = new stream.Transform({
2222

2323
src.pipe(dst);
2424

25-
functionparser_end(){
26-
assert.ok(loops>0);
27-
dst.removeAllListeners();
28-
}
29-
3025
dst.on('data',()=>{});
31-
dst.on('end',parser_end);
32-
dst.on('error',parser_end);
26+
dst.on('end',common.mustCall(()=>{
27+
assert.strictEqual(loops,3);
28+
assert.ok(src.isPaused());
29+
}));

0 commit comments

Comments
 (0)