import { expect, it } from "bun:test"; it("exists globally", () => { expect(typeof ReadableStream).toBe("function"); expect(typeof ReadableStreamBYOBReader).toBe("function"); expect(typeof ReadableStreamBYOBRequest).toBe("function"); expect(typeof ReadableStreamDefaultController).toBe("function"); expect(typeof ReadableStreamDefaultReader).toBe("function"); expect(typeof TransformStream).toBe("function"); expect(typeof TransformStreamDefaultController).toBe("function"); expect(typeof WritableStream).toBe("function"); expect(typeof WritableStreamDefaultController).toBe("function"); expect(typeof WritableStreamDefaultWriter).toBe("function"); expect(typeof ByteLengthQueuingStrategy).toBe("function"); expect(typeof CountQueuingStrategy).toBe("function"); }); it("ReadableStream", async () => { var stream = new ReadableStream({ start(controller) { controller.enqueue(Buffer.from("abdefgh")); }, pull(controller) {}, cancel() {}, type: "bytes", }); const chunks = []; const chunk = await stream.getReader().read(); chunks.push(chunk.value); expect(chunks[0].join("")).toBe(Buffer.from("abdefgh").join("")); });