From a5f92224b586289fc72f0abdb68b08eef9f017db Mon Sep 17 00:00:00 2001 From: Colin McDonnell Date: Wed, 22 Mar 2023 15:01:01 -0700 Subject: Fix types (#2453) * WIP * WIP * WIP * WIP * Improve typechecking in type files * Fix typechecking * Update * Update submodule * CI for typechecking * Add ci * Update commands * Format after build * Dont use bunx * Rename job * Use nodemodules prettier * Update workflow * Use symlink * Debug * Debug * Clean up and rename jobs --- test/js/web/html/FormData.test.ts | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'test/js/web/html/FormData.test.ts') diff --git a/test/js/web/html/FormData.test.ts b/test/js/web/html/FormData.test.ts index edefe8a53..af2871b10 100644 --- a/test/js/web/html/FormData.test.ts +++ b/test/js/web/html/FormData.test.ts @@ -1,7 +1,9 @@ import { afterAll, beforeAll, describe, expect, it, test } from "bun:test"; import fs, { chmodSync, unlinkSync } from "fs"; +import { gc, withoutAggressiveGC } from "harness"; import { mkfifo } from "mkfifo"; -import { gc, withoutAggressiveGC } from "../../gc"; + +gc; describe("FormData", () => { it("should be able to append a string", () => { @@ -14,14 +16,14 @@ describe("FormData", () => { it("should be able to append a Blob", async () => { const formData = new FormData(); formData.append("foo", new Blob(["bar"])); - expect(await formData.get("foo")!.text()).toBe("bar"); + expect(await ((await formData.get("foo")) as Blob)!.text()).toBe("bar"); expect(formData.getAll("foo")[0] instanceof Blob).toBe(true); }); it("should be able to set a Blob", async () => { const formData = new FormData(); formData.set("foo", new Blob(["bar"])); - expect(await formData.get("foo")!.text()).toBe("bar"); + expect(await ((await formData.get("foo")) as Blob).text()).toBe("bar"); expect(formData.getAll("foo")[0] instanceof Blob).toBe(true); }); @@ -135,8 +137,8 @@ describe("FormData", () => { C === Response ? new Response(body, { headers }) : new Request({ headers, body, url: "http://hello.com" }); const formData = await response.formData(); expect(formData instanceof FormData).toBe(true); - const entry = {}; - const expected = Object.assign({}, expected_); + const entry: { [k: string]: any } = {}; + const expected: { [k: string]: any } = Object.assign({}, expected_); for (const key of formData.keys()) { const values = formData.getAll(key); @@ -180,7 +182,7 @@ describe("FormData", () => { const b = bValues[i]; if (a instanceof Blob) { expect(b instanceof Blob).toBe(true); - expect(await a.text()).toBe(await b.text()); + expect(await a.text()).toBe(await (b as Blob).text()); } else { expect(a).toBe(b); } @@ -200,7 +202,7 @@ describe("FormData", () => { const b = bValues[i]; if (c instanceof Blob) { expect(b instanceof Blob).toBe(true); - expect(await c.text()).toBe(await b.text()); + expect(await c.text()).toBe(await (b as Blob).text()); } else { expect(c).toBe(b); } @@ -219,7 +221,7 @@ describe("FormData", () => { try { await response.formData(); throw "should have thrown"; - } catch (e) { + } catch (e: any) { expect(typeof e.message).toBe("string"); } }); @@ -233,7 +235,7 @@ describe("FormData", () => { try { await response.formData(); throw "should have thrown"; - } catch (e) { + } catch (e: any) { expect(typeof e.message).toBe("string"); } }); @@ -247,7 +249,7 @@ describe("FormData", () => { try { await response.formData(); throw "should have thrown"; - } catch (e) { + } catch (e: any) { expect(typeof e.message).toBe("string"); } }); -- cgit v1.2.3