Skip to content

Commit ac6b0c6

Browse files
lpincaBethGriggs
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 <[email protected]> Reviewed-By: Rich Trott <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]> Reviewed-By: Ricky Zhou <[email protected]>
1 parent c677427 commit ac6b0c6

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)