Skip to content

Commit

Permalink
test: improve test-stream-duplex-readable-end
Browse files Browse the repository at this point in the history
- 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]>
  • Loading branch information
lpinca authored and BethGriggs committed Dec 15, 2020
1 parent 1906f19 commit 8516c2e
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions test/parallel/test-stream-duplex-readable-end.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';
// https://github.com/nodejs/node/issues/35926
require('../common');
const common = require('../common');
const assert = require('assert');
const stream = require('stream');

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

src.pipe(dst);

function parser_end() {
assert.ok(loops > 0);
dst.removeAllListeners();
}

dst.on('data', () => { });
dst.on('end', parser_end);
dst.on('error', parser_end);
dst.on('end', common.mustCall(() => {
assert.strictEqual(loops, 3);
assert.ok(src.isPaused());
}));

0 comments on commit 8516c2e

Please sign in to comment.