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

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

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

+5-8
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+
const common = require('../common');
44
const assert = require('assert');
55
const stream = require('stream');
66

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

2323
src.pipe(dst);
2424

25-
function parser_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)