From 41b03b5c4c426bd3f2a3c7c6aaf454cee11744f0 Mon Sep 17 00:00:00 2001 From: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> Date: Mon, 20 Jun 2022 21:35:22 -0700 Subject: Cleanup tests --- integration/bunjs-only-snippets/unsafe.test.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'integration/bunjs-only-snippets/unsafe.test.js') diff --git a/integration/bunjs-only-snippets/unsafe.test.js b/integration/bunjs-only-snippets/unsafe.test.js index d47821f42..741dc0241 100644 --- a/integration/bunjs-only-snippets/unsafe.test.js +++ b/integration/bunjs-only-snippets/unsafe.test.js @@ -1,25 +1,26 @@ import { test, expect, it, describe } from "bun:test"; +import { gc } from "./gc"; it("arrayBufferToString u8", async () => { var encoder = new TextEncoder(); const bytes = encoder.encode("hello world"); - Bun.gc(true); + gc(true); expect(Bun.unsafe.arrayBufferToString(bytes)).toBe("hello world"); - Bun.gc(true); + gc(true); await new Promise((resolve) => setTimeout(resolve, 0)); - Bun.gc(true); + gc(true); }); it("arrayBufferToString ArrayBuffer", async () => { var encoder = new TextEncoder(); var bytes = encoder.encode("hello world"); - Bun.gc(true); + gc(true); const out = Bun.unsafe.arrayBufferToString(bytes.buffer); expect(out).toBe("hello world"); - Bun.gc(true); + gc(true); await new Promise((resolve) => setTimeout(resolve, 0)); globalThis.bytes = bytes; - Bun.gc(true); + gc(true); expect(out).toBe("hello world"); }); @@ -32,13 +33,13 @@ it("arrayBufferToString u16", () => { .arrayBufferToString(uint16) .split("") .map((a) => a.charCodeAt(0)); - Bun.gc(true); + gc(true); for (let i = 0; i < charCodes.length; i++) { expect("hello world"[i]).toBe(String.fromCharCode(charCodes[i])); } - Bun.gc(true); + gc(true); expect(charCodes.length).toBe("hello world".length); - Bun.gc(true); + gc(true); }); it("Bun.allocUnsafe", () => { -- cgit v1.2.3