Skip to content

Commit

Permalink
test(remix-server-runtime): remove polyfill references
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelDeBoey committed Aug 28, 2023
1 parent c28c3cc commit f3e8959
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 19 deletions.
30 changes: 12 additions & 18 deletions packages/remix-server-runtime/__tests__/formData-test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import {
Request as NodeRequest,
FormData as NodeFormData,
} from "@remix-run/web-fetch";
import { Blob, File } from "@remix-run/web-file";

import { parseMultipartFormData } from "../formData";

class CustomError extends Error {
Expand All @@ -14,12 +8,12 @@ class CustomError extends Error {

describe("parseMultipartFormData", () => {
it("can use a custom upload handler", async () => {
let formData = new NodeFormData();
let formData = new FormData();
formData.set("a", "value");
formData.set("blob", new Blob(["blob".repeat(1000)]), "blob.txt");
formData.set("file", new File(["file".repeat(1000)], "file.txt"));

let req = new NodeRequest("https://test.com", {
let req = new Request("https://test.com", {
method: "post",
body: formData,
});
Expand Down Expand Up @@ -48,12 +42,12 @@ describe("parseMultipartFormData", () => {
});

it("can return undefined", async () => {
let formData = new NodeFormData();
let formData = new FormData();
formData.set("a", "value");
formData.set("blob", new Blob(["blob".repeat(1000)]), "blob.txt");
formData.set("file", new File(["file".repeat(1000)], "file.txt"));

let req = new NodeRequest("https://test.com", {
let req = new Request("https://test.com", {
method: "post",
body: formData,
});
Expand All @@ -69,10 +63,10 @@ describe("parseMultipartFormData", () => {
});

it("can throw errors in upload handlers", async () => {
let formData = new NodeFormData();
let formData = new FormData();
formData.set("blob", new Blob(["blob"]), "blob.txt");

let req = new NodeRequest("https://test.com", {
let req = new Request("https://test.com", {
method: "post",
body: formData,
});
Expand All @@ -92,12 +86,12 @@ describe("parseMultipartFormData", () => {

describe("stream should propagate events", () => {
it("when controller errors", async () => {
let formData = new NodeFormData();
let formData = new FormData();
formData.set("a", "value");
formData.set("blob", new Blob(["blob".repeat(1000)]), "blob.txt");
formData.set("file", new File(["file".repeat(1000)], "file.txt"));

let underlyingRequest = new NodeRequest("https://test.com", {
let underlyingRequest = new Request("https://test.com", {
method: "post",
body: formData,
});
Expand All @@ -113,7 +107,7 @@ describe("parseMultipartFormData", () => {
},
});

let req = new NodeRequest("https://test.com", {
let req = new Request("https://test.com", {
method: "post",
body,
headers: underlyingRequest.headers,
Expand All @@ -132,12 +126,12 @@ describe("parseMultipartFormData", () => {
});

it("when controller is closed", async () => {
let formData = new NodeFormData();
let formData = new FormData();
formData.set("a", "value");
formData.set("blob", new Blob(["blob".repeat(1000)]), "blob.txt");
formData.set("file", new File(["file".repeat(1000)], "file.txt"));

let underlyingRequest = new NodeRequest("https://test.com", {
let underlyingRequest = new Request("https://test.com", {
method: "post",
body: formData,
});
Expand All @@ -153,7 +147,7 @@ describe("parseMultipartFormData", () => {
},
});

let req = new NodeRequest("https://test.com", {
let req = new Request("https://test.com", {
method: "post",
body,
headers: underlyingRequest.headers,
Expand Down
1 change: 1 addition & 0 deletions packages/remix-server-runtime/__tests__/setup.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
import { installGlobals } from "@remix-run/node";

installGlobals();
1 change: 0 additions & 1 deletion packages/remix-server-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"type-fest": "^4.0.0"
},
"devDependencies": {
"@remix-run/web-file": "^3.0.3",
"@types/set-cookie-parser": "^2.4.1",
"typescript": "^5.1.6"
},
Expand Down

0 comments on commit f3e8959

Please sign in to comment.