Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brophdawg11 committed Jun 25, 2024
1 parent 385608d commit 781cbf9
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions packages/react-router/__tests__/router/fetchers-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ describe("fetchers", () => {
formData: createFormData({ key: "value" }),
});
expect(A.fetcher.state).toBe("loading");
expect(A.fetcher.formMethod).toBe("get");
expect(A.fetcher.formMethod).toBe("GET");
expect(A.fetcher.formAction).toBe("/foo");
expect(A.fetcher.formData).toEqual(createFormData({ key: "value" }));
expect(A.fetcher.formEncType).toBe("application/x-www-form-urlencoded");
Expand Down Expand Up @@ -2111,7 +2111,7 @@ describe("fetchers", () => {
"formAction": "/two/three",
"formData": FormData {},
"formEncType": "application/x-www-form-urlencoded",
"formMethod": "post",
"formMethod": "POST",
"json": undefined,
"nextParams": {
"a": "two",
Expand Down
10 changes: 5 additions & 5 deletions packages/react-router/__tests__/router/navigation-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,7 @@ describe("navigations", () => {
// @ts-expect-error
new URLSearchParams(navigation.formData).toString()
).toBe("gosh=dang");
expect(navigation.formMethod).toBe("post");
expect(navigation.formMethod).toBe("POST");
expect(navigation.formEncType).toBe("application/x-www-form-urlencoded");
expect(navigation.location).toMatchObject({
pathname: "/foo",
Expand All @@ -1169,7 +1169,7 @@ describe("navigations", () => {
// @ts-expect-error
new URLSearchParams(navigation.formData).toString()
).toBe("gosh=dang");
expect(navigation.formMethod).toBe("post");
expect(navigation.formMethod).toBe("POST");
expect(navigation.formEncType).toBe("application/x-www-form-urlencoded");
expect(navigation.location).toMatchObject({
pathname: "/foo",
Expand Down Expand Up @@ -1203,7 +1203,7 @@ describe("navigations", () => {
// @ts-expect-error
new URLSearchParams(navigation.formData).toString()
).toBe("gosh=dang");
expect(navigation.formMethod).toBe("post");
expect(navigation.formMethod).toBe("POST");
expect(navigation.location).toMatchObject({
pathname: "/bar",
search: "",
Expand All @@ -1229,7 +1229,7 @@ describe("navigations", () => {
let navigation = t.router.state.navigation;
expect(navigation.state).toBe("loading");
expect(navigation.formData).toEqual(createFormData({ gosh: "dang" }));
expect(navigation.formMethod).toBe("get");
expect(navigation.formMethod).toBe("GET");
expect(navigation.formEncType).toBe("application/x-www-form-urlencoded");
expect(navigation.location).toMatchObject({
pathname: "/foo",
Expand Down Expand Up @@ -1257,7 +1257,7 @@ describe("navigations", () => {
let navigation = t.router.state.navigation;
expect(navigation.state).toBe("loading");
expect(navigation.formData).toEqual(createFormData({ gosh: "dang" }));
expect(navigation.formMethod).toBe("get");
expect(navigation.formMethod).toBe("GET");
expect(navigation.formEncType).toBe("application/x-www-form-urlencoded");
expect(navigation.location?.pathname).toBe("/bar");

Expand Down
2 changes: 1 addition & 1 deletion packages/react-router/__tests__/router/revalidate-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ describe("router.revalidate", () => {
pathname: "/tasks",
search: "?key=value",
},
formMethod: "get",
formMethod: "GET",
formData: createFormData({ key: "value" }),
},
revalidation: "loading",
Expand Down
8 changes: 4 additions & 4 deletions packages/react-router/__tests__/router/router-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,7 @@ describe("a router", () => {
pathname: "/tasks",
search: "?key=value",
});
expect(t.router.state.navigation.formMethod).toBe("get");
expect(t.router.state.navigation.formMethod).toBe("GET");
expect(t.router.state.navigation.formData).toEqual(
createFormData({ key: "value" })
);
Expand All @@ -710,7 +710,7 @@ describe("a router", () => {
pathname: "/tasks",
search: "?key=value",
});
expect(t.router.state.navigation.formMethod).toBe("get");
expect(t.router.state.navigation.formMethod).toBe("GET");
expect(t.router.state.navigation.formData).toEqual(
createFormData({ key: "value" })
);
Expand All @@ -730,7 +730,7 @@ describe("a router", () => {
pathname: "/tasks",
search: "?key=2",
});
expect(t.router.state.navigation.formMethod).toBe("get");
expect(t.router.state.navigation.formMethod).toBe("GET");
expect(t.router.state.navigation.formData).toEqual(
createFormData({ key: "2" })
);
Expand All @@ -750,7 +750,7 @@ describe("a router", () => {
pathname: "/tasks",
search: "?key=1",
});
expect(t.router.state.navigation.formMethod).toBe("post");
expect(t.router.state.navigation.formMethod).toBe("POST");
expect(t.router.state.navigation.formData).toEqual(
createFormData({ key: "2" })
);
Expand Down
16 changes: 8 additions & 8 deletions packages/react-router/__tests__/router/should-revalidate-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ describe("shouldRevalidate", () => {
nextParams: {},
nextUrl: expect.urlMatch("http://localhost/child"),
defaultShouldRevalidate: true,
formMethod: "post",
formMethod: "POST",
formAction: "/child",
formEncType: "application/x-www-form-urlencoded",
actionResult: "ACTION",
Expand Down Expand Up @@ -310,7 +310,7 @@ describe("shouldRevalidate", () => {
nextParams: {},
nextUrl: expect.urlMatch("http://localhost/"),
defaultShouldRevalidate: true,
formMethod: "post",
formMethod: "POST",
formAction: "/child",
formEncType: "application/x-www-form-urlencoded",
actionResult: undefined,
Expand Down Expand Up @@ -364,7 +364,7 @@ describe("shouldRevalidate", () => {
nextParams: {},
nextUrl: expect.urlMatch("http://localhost/child"),
defaultShouldRevalidate: true,
formMethod: "post",
formMethod: "POST",
formAction: "/child",
formEncType: "application/x-www-form-urlencoded",
actionResult: "ACTION",
Expand Down Expand Up @@ -406,7 +406,7 @@ describe("shouldRevalidate", () => {
// @ts-expect-error
let arg = shouldRevalidate.mock.calls[0][0];
let expectedArg: Partial<ShouldRevalidateFunctionArgs> = {
formMethod: "post",
formMethod: "POST",
formAction: "/",
formEncType: "application/json",
text: undefined,
Expand Down Expand Up @@ -448,7 +448,7 @@ describe("shouldRevalidate", () => {
// @ts-expect-error
let arg = shouldRevalidate.mock.calls[0][0];
let expectedArg: Partial<ShouldRevalidateFunctionArgs> = {
formMethod: "post",
formMethod: "POST",
formAction: "/",
formEncType: "text/plain",
text: "hello world",
Expand Down Expand Up @@ -657,7 +657,7 @@ describe("shouldRevalidate", () => {
formAction: "/child",
formData: createFormData({}),
formEncType: "application/x-www-form-urlencoded",
formMethod: "post",
formMethod: "POST",
defaultShouldRevalidate: true,
});

Expand Down Expand Up @@ -715,7 +715,7 @@ describe("shouldRevalidate", () => {
"formAction": "/fetch",
"formData": FormData {},
"formEncType": "application/x-www-form-urlencoded",
"formMethod": "post",
"formMethod": "POST",
"json": undefined,
"nextParams": {},
"nextUrl": "http://localhost/",
Expand Down Expand Up @@ -779,7 +779,7 @@ describe("shouldRevalidate", () => {
"formAction": "/fetch",
"formData": FormData {},
"formEncType": "application/x-www-form-urlencoded",
"formMethod": "post",
"formMethod": "POST",
"json": undefined,
"nextParams": {},
"nextUrl": "http://localhost/",
Expand Down
12 changes: 6 additions & 6 deletions packages/react-router/__tests__/router/submission-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,16 +504,16 @@ describe("submissions", () => {
formMethod: "get",
formData: createFormData({}),
});
expect(t.router.state.navigation.formMethod).toBe("get");
expect(t.router.state.navigation.formMethod).toBe("GET");
await A.loaders.child.resolve("LOADER");
expect(t.router.state.navigation.formMethod).toBeUndefined();
await t.router.navigate("/");

let B = await t.navigate("/child", {
formMethod: "POST",
formMethod: "post",
formData: createFormData({}),
});
expect(t.router.state.navigation.formMethod).toBe("post");
expect(t.router.state.navigation.formMethod).toBe("POST");
await B.actions.child.resolve("ACTION");
await B.loaders.child.resolve("LOADER");
expect(t.router.state.navigation.formMethod).toBeUndefined();
Expand All @@ -523,15 +523,15 @@ describe("submissions", () => {
formMethod: "GET",
formData: createFormData({}),
});
expect(t.router.state.fetchers.get("key")?.formMethod).toBe("get");
expect(t.router.state.fetchers.get("key")?.formMethod).toBe("GET");
await C.loaders.child.resolve("LOADER FETCH");
expect(t.router.state.fetchers.get("key")?.formMethod).toBeUndefined();

let D = await t.fetch("/child", "key", {
formMethod: "post",
formMethod: "POST",
formData: createFormData({}),
});
expect(t.router.state.fetchers.get("key")?.formMethod).toBe("post");
expect(t.router.state.fetchers.get("key")?.formMethod).toBe("POST");
await D.actions.child.resolve("ACTION FETCH");
expect(t.router.state.fetchers.get("key")?.formMethod).toBeUndefined();
});
Expand Down

0 comments on commit 781cbf9

Please sign in to comment.