aboutsummaryrefslogtreecommitdiff
path: root/test/js/web/html/FormData.test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'test/js/web/html/FormData.test.ts')
-rw-r--r--test/js/web/html/FormData.test.ts13
1 files changed, 8 insertions, 5 deletions
diff --git a/test/js/web/html/FormData.test.ts b/test/js/web/html/FormData.test.ts
index 9d0db4361..edefe8a53 100644
--- a/test/js/web/html/FormData.test.ts
+++ b/test/js/web/html/FormData.test.ts
@@ -14,14 +14,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 formData.get("foo")!.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 formData.get("foo")!.text()).toBe("bar");
expect(formData.getAll("foo")[0] instanceof Blob).toBe(true);
});
@@ -131,7 +131,8 @@ describe("FormData", () => {
const Class = [Response, Request] as const;
for (const C of Class) {
it(`should parse multipart/form-data (${name}) with ${C.name}`, async () => {
- const response = C === Response ? new Response(body, { headers }) : new Request({ headers, body });
+ const response =
+ 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 = {};
@@ -159,7 +160,8 @@ describe("FormData", () => {
});
it(`should roundtrip multipart/form-data (${name}) with ${C.name}`, async () => {
- const response = C === Response ? new Response(body, { headers }) : new Request({ headers, body });
+ const response =
+ 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);
@@ -306,7 +308,8 @@ describe("FormData", () => {
await Bun.write(path, "foo!");
const formData = new FormData();
formData.append("foo", Bun.file(path));
- const response = C === Response ? new Response(formData) : new Request({ body: formData });
+ const response =
+ C === Response ? new Response(formData) : new Request({ body: formData, url: "http://example.com" });
expect(response.headers.get("content-type")?.startsWith("multipart/form-data;")).toBe(true);
const formData2 = await response.formData();