diff options
Diffstat (limited to 'test/bun.js/react-dom.test.tsx')
-rw-r--r-- | test/bun.js/react-dom.test.tsx | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/bun.js/react-dom.test.tsx b/test/bun.js/react-dom.test.tsx index 42f4c7631..678f1ee9a 100644 --- a/test/bun.js/react-dom.test.tsx +++ b/test/bun.js/react-dom.test.tsx @@ -186,6 +186,33 @@ describe("ReactDOM", () => { expect(text.replaceAll("<!-- -->", "")).toBe(inputString); gc(); }); + it("for await (chunk of stream)", async () => { + const stream = await renderToReadableStream(reactElement); + gc(); + const chunks = []; + for await (let chunk of stream) { + chunks.push(chunk); + } + const text = await new Response(chunks).text(); + gc(); + expect(text.replaceAll("<!-- -->", "")).toBe(inputString); + gc(); + }); + + it("for await (chunk of stream) (arrayBuffer)", async () => { + const stream = await renderToReadableStream(reactElement); + gc(); + const chunks = []; + for await (let chunk of stream) { + chunks.push(chunk); + } + const text = new TextDecoder().decode( + await new Response(chunks).arrayBuffer() + ); + gc(); + expect(text.replaceAll("<!-- -->", "")).toBe(inputString); + gc(); + }); }); } } |