mirror of
https://github.com/nodejs/node.git
synced 2026-11-25 23:01:06 -05:00
test: add regression test for 51586
Signed-off-by: Matteo Collina <hello@matteocollina.com> PR-URL: https://github.com/nodejs/node/pull/51491 Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br> Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com> Reviewed-By: Matthew Aitken <maitken033380023@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Moshe Atlow <moshe@atlow.co.il> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This commit is contained in:
1 parent
6ee5f50789
commit
f2dfe0fa80
1 file changed
+28
@@ -0,0 +1,28 @@
|
||||
import '../common/index.mjs';
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert';
|
||||
|
||||
test('do not leak promises', async () => {
|
||||
const buf = new Uint8Array(1);
|
||||
const readable = new ReadableStream({
|
||||
start(controller) {
|
||||
controller.enqueue(buf);
|
||||
controller.close();
|
||||
}
|
||||
});
|
||||
|
||||
const [out1, out2] = readable.tee();
|
||||
const cloned = structuredClone(out2, { transfer: [out2] });
|
||||
|
||||
for await (const chunk of cloned) {
|
||||
assert.deepStrictEqual(chunk, buf);
|
||||
}
|
||||
|
||||
for await (const chunk of out2) {
|
||||
assert.deepStrictEqual(chunk, buf);
|
||||
}
|
||||
|
||||
for await (const chunk of out1) {
|
||||
assert.deepStrictEqual(chunk, buf);
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user