diff options
author | 2022-06-20 21:35:22 -0700 | |
---|---|---|
committer | 2022-06-22 06:56:47 -0700 | |
commit | 41b03b5c4c426bd3f2a3c7c6aaf454cee11744f0 (patch) | |
tree | fd1819ed5dfbe58edfe971b7c05c2c59549b8251 /integration/bunjs-only-snippets/streams.test.js | |
parent | bfa5b2955533a60b2f12e6ac65d4868efcaf5222 (diff) | |
download | bun-41b03b5c4c426bd3f2a3c7c6aaf454cee11744f0.tar.gz bun-41b03b5c4c426bd3f2a3c7c6aaf454cee11744f0.tar.zst bun-41b03b5c4c426bd3f2a3c7c6aaf454cee11744f0.zip |
Cleanup tests
Diffstat (limited to 'integration/bunjs-only-snippets/streams.test.js')
-rw-r--r-- | integration/bunjs-only-snippets/streams.test.js | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/integration/bunjs-only-snippets/streams.test.js b/integration/bunjs-only-snippets/streams.test.js index 59da95b5a..ccbea1d09 100644 --- a/integration/bunjs-only-snippets/streams.test.js +++ b/integration/bunjs-only-snippets/streams.test.js @@ -1,14 +1,12 @@ -import { - file, - gc, - readableStreamToArrayBuffer, - readableStreamToArray, -} from "bun"; -import { expect, it } from "bun:test"; +import { file, readableStreamToArrayBuffer, readableStreamToArray } from "bun"; +import { expect, it, beforeEach, afterEach } from "bun:test"; import { writeFileSync } from "node:fs"; - +import { gc } from "./gc"; new Uint8Array(); +beforeEach(() => gc()); +afterEach(() => gc()); + it("exists globally", () => { expect(typeof ReadableStream).toBe("function"); expect(typeof ReadableStreamBYOBReader).toBe("function"); @@ -42,18 +40,14 @@ it("ReadableStream (direct)", async () => { }); it("ReadableStream (bytes)", async () => { - console.trace(); - var stream = new ReadableStream({ start(controller) { - console.log("there"); controller.enqueue(Buffer.from("abdefgh")); }, pull(controller) {}, cancel() {}, type: "bytes", }); - console.log("here"); const chunks = []; const chunk = await stream.getReader().read(); chunks.push(chunk.value); @@ -61,7 +55,6 @@ it("ReadableStream (bytes)", async () => { }); it("ReadableStream (default)", async () => { - console.trace(); var stream = new ReadableStream({ start(controller) { controller.enqueue(Buffer.from("abdefgh")); @@ -77,7 +70,6 @@ it("ReadableStream (default)", async () => { }); it("readableStreamToArray", async () => { - console.trace(); var queue = [Buffer.from("abdefgh")]; var stream = new ReadableStream({ pull(controller) { @@ -98,7 +90,6 @@ it("readableStreamToArray", async () => { }); it("readableStreamToArrayBuffer (bytes)", async () => { - console.trace(); var queue = [Buffer.from("abdefgh")]; var stream = new ReadableStream({ pull(controller) { @@ -135,7 +126,6 @@ it("readableStreamToArrayBuffer (default)", async () => { }); it("ReadableStream for Blob", async () => { - console.trace(); var blob = new Blob(["abdefgh", "ijklmnop"]); expect(await blob.text()).toBe("abdefghijklmnop"); var stream; @@ -168,7 +158,6 @@ it("ReadableStream for Blob", async () => { }); it("ReadableStream for File", async () => { - console.trace(); var blob = file(import.meta.dir + "/fetch.js.txt"); var stream = blob.stream(24); const chunks = []; |