summaryrefslogtreecommitdiff
path: root/tests/node_compat/test/parallel/test-stream-duplex-readable-end.js
diff options
context:
space:
mode:
Diffstat (limited to 'tests/node_compat/test/parallel/test-stream-duplex-readable-end.js')
-rw-r--r--tests/node_compat/test/parallel/test-stream-duplex-readable-end.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/node_compat/test/parallel/test-stream-duplex-readable-end.js b/tests/node_compat/test/parallel/test-stream-duplex-readable-end.js
new file mode 100644
index 000000000..87327814c
--- /dev/null
+++ b/tests/node_compat/test/parallel/test-stream-duplex-readable-end.js
@@ -0,0 +1,36 @@
+// deno-fmt-ignore-file
+// deno-lint-ignore-file
+
+// Copyright Joyent and Node contributors. All rights reserved. MIT license.
+// Taken from Node 18.12.1
+// This file is automatically generated by `tools/node_compat/setup.ts`. Do not modify this file manually.
+
+'use strict';
+// https://github.com/nodejs/node/issues/35926
+const common = require('../common');
+const assert = require('assert');
+const stream = require('stream');
+
+let loops = 5;
+
+const src = new stream.Readable({
+ read() {
+ if (loops--)
+ this.push(Buffer.alloc(20000));
+ }
+});
+
+const dst = new stream.Transform({
+ transform(chunk, output, fn) {
+ this.push(null);
+ fn();
+ }
+});
+
+src.pipe(dst);
+
+dst.on('data', () => { });
+dst.on('end', common.mustCall(() => {
+ assert.strictEqual(loops, 3);
+ assert.ok(src.isPaused());
+}));