Skip to content

Commit 781cbf9

Browse files
committed
Fix tests
1 parent 385608d commit 781cbf9

File tree

6 files changed

+26
-26
lines changed

6 files changed

+26
-26
lines changed

packages/react-router/__tests__/router/fetchers-test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ describe("fetchers", () => {
169169
formData: createFormData({ key: "value" }),
170170
});
171171
expect(A.fetcher.state).toBe("loading");
172-
expect(A.fetcher.formMethod).toBe("get");
172+
expect(A.fetcher.formMethod).toBe("GET");
173173
expect(A.fetcher.formAction).toBe("/foo");
174174
expect(A.fetcher.formData).toEqual(createFormData({ key: "value" }));
175175
expect(A.fetcher.formEncType).toBe("application/x-www-form-urlencoded");
@@ -2111,7 +2111,7 @@ describe("fetchers", () => {
21112111
"formAction": "/two/three",
21122112
"formData": FormData {},
21132113
"formEncType": "application/x-www-form-urlencoded",
2114-
"formMethod": "post",
2114+
"formMethod": "POST",
21152115
"json": undefined,
21162116
"nextParams": {
21172117
"a": "two",

packages/react-router/__tests__/router/navigation-test.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,7 @@ describe("navigations", () => {
11541154
// @ts-expect-error
11551155
new URLSearchParams(navigation.formData).toString()
11561156
).toBe("gosh=dang");
1157-
expect(navigation.formMethod).toBe("post");
1157+
expect(navigation.formMethod).toBe("POST");
11581158
expect(navigation.formEncType).toBe("application/x-www-form-urlencoded");
11591159
expect(navigation.location).toMatchObject({
11601160
pathname: "/foo",
@@ -1169,7 +1169,7 @@ describe("navigations", () => {
11691169
// @ts-expect-error
11701170
new URLSearchParams(navigation.formData).toString()
11711171
).toBe("gosh=dang");
1172-
expect(navigation.formMethod).toBe("post");
1172+
expect(navigation.formMethod).toBe("POST");
11731173
expect(navigation.formEncType).toBe("application/x-www-form-urlencoded");
11741174
expect(navigation.location).toMatchObject({
11751175
pathname: "/foo",
@@ -1203,7 +1203,7 @@ describe("navigations", () => {
12031203
// @ts-expect-error
12041204
new URLSearchParams(navigation.formData).toString()
12051205
).toBe("gosh=dang");
1206-
expect(navigation.formMethod).toBe("post");
1206+
expect(navigation.formMethod).toBe("POST");
12071207
expect(navigation.location).toMatchObject({
12081208
pathname: "/bar",
12091209
search: "",
@@ -1229,7 +1229,7 @@ describe("navigations", () => {
12291229
let navigation = t.router.state.navigation;
12301230
expect(navigation.state).toBe("loading");
12311231
expect(navigation.formData).toEqual(createFormData({ gosh: "dang" }));
1232-
expect(navigation.formMethod).toBe("get");
1232+
expect(navigation.formMethod).toBe("GET");
12331233
expect(navigation.formEncType).toBe("application/x-www-form-urlencoded");
12341234
expect(navigation.location).toMatchObject({
12351235
pathname: "/foo",
@@ -1257,7 +1257,7 @@ describe("navigations", () => {
12571257
let navigation = t.router.state.navigation;
12581258
expect(navigation.state).toBe("loading");
12591259
expect(navigation.formData).toEqual(createFormData({ gosh: "dang" }));
1260-
expect(navigation.formMethod).toBe("get");
1260+
expect(navigation.formMethod).toBe("GET");
12611261
expect(navigation.formEncType).toBe("application/x-www-form-urlencoded");
12621262
expect(navigation.location?.pathname).toBe("/bar");
12631263

packages/react-router/__tests__/router/revalidate-test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ describe("router.revalidate", () => {
271271
pathname: "/tasks",
272272
search: "?key=value",
273273
},
274-
formMethod: "get",
274+
formMethod: "GET",
275275
formData: createFormData({ key: "value" }),
276276
},
277277
revalidation: "loading",

packages/react-router/__tests__/router/router-test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -690,7 +690,7 @@ describe("a router", () => {
690690
pathname: "/tasks",
691691
search: "?key=value",
692692
});
693-
expect(t.router.state.navigation.formMethod).toBe("get");
693+
expect(t.router.state.navigation.formMethod).toBe("GET");
694694
expect(t.router.state.navigation.formData).toEqual(
695695
createFormData({ key: "value" })
696696
);
@@ -710,7 +710,7 @@ describe("a router", () => {
710710
pathname: "/tasks",
711711
search: "?key=value",
712712
});
713-
expect(t.router.state.navigation.formMethod).toBe("get");
713+
expect(t.router.state.navigation.formMethod).toBe("GET");
714714
expect(t.router.state.navigation.formData).toEqual(
715715
createFormData({ key: "value" })
716716
);
@@ -730,7 +730,7 @@ describe("a router", () => {
730730
pathname: "/tasks",
731731
search: "?key=2",
732732
});
733-
expect(t.router.state.navigation.formMethod).toBe("get");
733+
expect(t.router.state.navigation.formMethod).toBe("GET");
734734
expect(t.router.state.navigation.formData).toEqual(
735735
createFormData({ key: "2" })
736736
);
@@ -750,7 +750,7 @@ describe("a router", () => {
750750
pathname: "/tasks",
751751
search: "?key=1",
752752
});
753-
expect(t.router.state.navigation.formMethod).toBe("post");
753+
expect(t.router.state.navigation.formMethod).toBe("POST");
754754
expect(t.router.state.navigation.formData).toEqual(
755755
createFormData({ key: "2" })
756756
);

packages/react-router/__tests__/router/should-revalidate-test.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ describe("shouldRevalidate", () => {
256256
nextParams: {},
257257
nextUrl: expect.urlMatch("http://localhost/child"),
258258
defaultShouldRevalidate: true,
259-
formMethod: "post",
259+
formMethod: "POST",
260260
formAction: "/child",
261261
formEncType: "application/x-www-form-urlencoded",
262262
actionResult: "ACTION",
@@ -310,7 +310,7 @@ describe("shouldRevalidate", () => {
310310
nextParams: {},
311311
nextUrl: expect.urlMatch("http://localhost/"),
312312
defaultShouldRevalidate: true,
313-
formMethod: "post",
313+
formMethod: "POST",
314314
formAction: "/child",
315315
formEncType: "application/x-www-form-urlencoded",
316316
actionResult: undefined,
@@ -364,7 +364,7 @@ describe("shouldRevalidate", () => {
364364
nextParams: {},
365365
nextUrl: expect.urlMatch("http://localhost/child"),
366366
defaultShouldRevalidate: true,
367-
formMethod: "post",
367+
formMethod: "POST",
368368
formAction: "/child",
369369
formEncType: "application/x-www-form-urlencoded",
370370
actionResult: "ACTION",
@@ -406,7 +406,7 @@ describe("shouldRevalidate", () => {
406406
// @ts-expect-error
407407
let arg = shouldRevalidate.mock.calls[0][0];
408408
let expectedArg: Partial<ShouldRevalidateFunctionArgs> = {
409-
formMethod: "post",
409+
formMethod: "POST",
410410
formAction: "/",
411411
formEncType: "application/json",
412412
text: undefined,
@@ -448,7 +448,7 @@ describe("shouldRevalidate", () => {
448448
// @ts-expect-error
449449
let arg = shouldRevalidate.mock.calls[0][0];
450450
let expectedArg: Partial<ShouldRevalidateFunctionArgs> = {
451-
formMethod: "post",
451+
formMethod: "POST",
452452
formAction: "/",
453453
formEncType: "text/plain",
454454
text: "hello world",
@@ -657,7 +657,7 @@ describe("shouldRevalidate", () => {
657657
formAction: "/child",
658658
formData: createFormData({}),
659659
formEncType: "application/x-www-form-urlencoded",
660-
formMethod: "post",
660+
formMethod: "POST",
661661
defaultShouldRevalidate: true,
662662
});
663663

@@ -715,7 +715,7 @@ describe("shouldRevalidate", () => {
715715
"formAction": "/fetch",
716716
"formData": FormData {},
717717
"formEncType": "application/x-www-form-urlencoded",
718-
"formMethod": "post",
718+
"formMethod": "POST",
719719
"json": undefined,
720720
"nextParams": {},
721721
"nextUrl": "http://localhost/",
@@ -779,7 +779,7 @@ describe("shouldRevalidate", () => {
779779
"formAction": "/fetch",
780780
"formData": FormData {},
781781
"formEncType": "application/x-www-form-urlencoded",
782-
"formMethod": "post",
782+
"formMethod": "POST",
783783
"json": undefined,
784784
"nextParams": {},
785785
"nextUrl": "http://localhost/",

packages/react-router/__tests__/router/submission-test.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -504,16 +504,16 @@ describe("submissions", () => {
504504
formMethod: "get",
505505
formData: createFormData({}),
506506
});
507-
expect(t.router.state.navigation.formMethod).toBe("get");
507+
expect(t.router.state.navigation.formMethod).toBe("GET");
508508
await A.loaders.child.resolve("LOADER");
509509
expect(t.router.state.navigation.formMethod).toBeUndefined();
510510
await t.router.navigate("/");
511511

512512
let B = await t.navigate("/child", {
513-
formMethod: "POST",
513+
formMethod: "post",
514514
formData: createFormData({}),
515515
});
516-
expect(t.router.state.navigation.formMethod).toBe("post");
516+
expect(t.router.state.navigation.formMethod).toBe("POST");
517517
await B.actions.child.resolve("ACTION");
518518
await B.loaders.child.resolve("LOADER");
519519
expect(t.router.state.navigation.formMethod).toBeUndefined();
@@ -523,15 +523,15 @@ describe("submissions", () => {
523523
formMethod: "GET",
524524
formData: createFormData({}),
525525
});
526-
expect(t.router.state.fetchers.get("key")?.formMethod).toBe("get");
526+
expect(t.router.state.fetchers.get("key")?.formMethod).toBe("GET");
527527
await C.loaders.child.resolve("LOADER FETCH");
528528
expect(t.router.state.fetchers.get("key")?.formMethod).toBeUndefined();
529529

530530
let D = await t.fetch("/child", "key", {
531-
formMethod: "post",
531+
formMethod: "POST",
532532
formData: createFormData({}),
533533
});
534-
expect(t.router.state.fetchers.get("key")?.formMethod).toBe("post");
534+
expect(t.router.state.fetchers.get("key")?.formMethod).toBe("POST");
535535
await D.actions.child.resolve("ACTION FETCH");
536536
expect(t.router.state.fetchers.get("key")?.formMethod).toBeUndefined();
537537
});

0 commit comments

Comments
 (0)