Skip to content

Commit 34d2514

Browse files
committed
fix test
1 parent 6a2b5d1 commit 34d2514

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

apps/webapp/test/billingLimitsRoute.test.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, expect, it } from "vitest";
2-
import { parse } from "@conform-to/zod";
2+
import { parseWithZod } from "@conform-to/zod";
33
import { billingAlertsSchema } from "~/components/billing/BillingAlertsSection";
44
import {
55
billingLimitFormSchema,
@@ -187,7 +187,7 @@ describe("billing-limits form validation", () => {
187187
formData.append("alertLevels", "75");
188188
formData.append("alertLevels", "75");
189189

190-
const submission = parse(formData, { schema: billingAlertsSchema });
190+
const submission = parseWithZod(formData, { schema: billingAlertsSchema });
191191
expect(submission.error?.alertLevels).toBeTruthy();
192192
});
193193

@@ -198,7 +198,7 @@ describe("billing-limits form validation", () => {
198198
formData.append("alertLevels", "75");
199199
formData.append("alertLevels", "not-a-number");
200200

201-
const submission = parse(formData, { schema: billingAlertsSchema });
201+
const submission = parseWithZod(formData, { schema: billingAlertsSchema });
202202
expect(submission.error?.["alertLevels[1]"]).toBeTruthy();
203203
});
204204

@@ -209,7 +209,7 @@ describe("billing-limits form validation", () => {
209209
formData.set("amount", "100");
210210
formData.set("cancelInProgressRuns", "on");
211211

212-
const submission = parse(formData, { schema: billingLimitFormSchema });
212+
const submission = parseWithZod(formData, { schema: billingLimitFormSchema });
213213
expect(submission.value).toEqual({
214214
mode: "custom",
215215
amount: 100,
@@ -222,7 +222,7 @@ describe("billing-limits form validation", () => {
222222
formData.set("mode", "none");
223223
formData.set("cancelInProgressRuns", "on");
224224

225-
const submission = parse(formData, { schema: billingLimitFormSchema });
225+
const submission = parseWithZod(formData, { schema: billingLimitFormSchema });
226226
expect(submission.value?.mode).toBe("none");
227227
expect(submission.value?.cancelInProgressRuns).toBe(true);
228228
});
@@ -234,7 +234,7 @@ describe("billing-limits form validation", () => {
234234
formData.set("newAmount", "1500");
235235
formData.set("resumeMode", "queue");
236236

237-
const submission = parse(formData, { schema: billingLimitRecoveryFormSchema });
237+
const submission = parseWithZod(formData, { schema: billingLimitRecoveryFormSchema });
238238
expect(submission.value).toEqual({
239239
action: "increase",
240240
newAmount: 1500,
@@ -247,7 +247,7 @@ describe("billing-limits form validation", () => {
247247
formData.set("action", "remove");
248248
formData.set("resumeMode", "new_only");
249249

250-
const submission = parse(formData, { schema: billingLimitRecoveryFormSchema });
250+
const submission = parseWithZod(formData, { schema: billingLimitRecoveryFormSchema });
251251
expect(submission.value).toEqual({
252252
action: "remove",
253253
resumeMode: "new_only",
@@ -302,47 +302,47 @@ describe("isBillingLimitFormDirty", () => {
302302

303303
describe("getBillingLimitFormLastSubmission", () => {
304304
it("drops amount errors when the selected mode is not custom", () => {
305-
const submission = parse(
305+
const submission = parseWithZod(
306306
(() => {
307307
const formData = new FormData();
308308
formData.set("mode", "custom");
309309
formData.set("amount", "0");
310310
return formData;
311311
})(),
312312
{ schema: billingLimitFormSchema }
313-
);
313+
).reply();
314314

315315
expect(
316316
getBillingLimitFormLastSubmission(submission, "plan", true)?.error?.amount
317317
).toBeUndefined();
318318
});
319319

320320
it("keeps amount errors while custom mode is selected", () => {
321-
const submission = parse(
321+
const submission = parseWithZod(
322322
(() => {
323323
const formData = new FormData();
324324
formData.set("mode", "custom");
325325
formData.set("amount", "0");
326326
return formData;
327327
})(),
328328
{ schema: billingLimitFormSchema }
329-
);
329+
).reply();
330330

331331
expect(
332332
getBillingLimitFormLastSubmission(submission, "custom", true)?.error?.amount
333333
).toBeTruthy();
334334
});
335335

336336
it("returns undefined when the form is clean", () => {
337-
const submission = parse(
337+
const submission = parseWithZod(
338338
(() => {
339339
const formData = new FormData();
340340
formData.set("mode", "custom");
341341
formData.set("amount", "0");
342342
return formData;
343343
})(),
344344
{ schema: billingLimitFormSchema }
345-
);
345+
).reply();
346346

347347
expect(getBillingLimitFormLastSubmission(submission, "custom", false)).toBeUndefined();
348348
});

0 commit comments

Comments
 (0)