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 committed Nov 14, 2020
1 parent 22293ea commit d5e4e19
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 d5e4e19

Please sign in to comment.