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 <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>
  • 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
@@ -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.