refactor(data): replace schema classes with readonly models
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { PaymentPlan } from "@/data/schemas/payment";
|
||||
import {
|
||||
PaymentPlanSchema,
|
||||
type PaymentPlan,
|
||||
type PaymentPlanInput,
|
||||
} from "@/data/schemas/payment";
|
||||
|
||||
import {
|
||||
canChooseSubscriptionPayChannel,
|
||||
@@ -13,10 +17,8 @@ import {
|
||||
toVipOfferPlanViews,
|
||||
} from "../subscription-screen.helpers";
|
||||
|
||||
function makePlan(
|
||||
overrides: Partial<Parameters<typeof PaymentPlan.from>[0]>,
|
||||
): PaymentPlan {
|
||||
return PaymentPlan.from({
|
||||
function makePlan(overrides: Partial<PaymentPlanInput>): PaymentPlan {
|
||||
return PaymentPlanSchema.parse({
|
||||
planId: "plan",
|
||||
planName: "Plan",
|
||||
orderType: "vip_monthly",
|
||||
@@ -138,7 +140,9 @@ describe("subscription screen helpers", () => {
|
||||
originalPrice: "",
|
||||
},
|
||||
],
|
||||
coinPlans: [{ id: "coin_1000", coins: 1000, price: "9.90", currency: "US$" }],
|
||||
coinPlans: [
|
||||
{ id: "coin_1000", coins: 1000, price: "9.90", currency: "US$" },
|
||||
],
|
||||
});
|
||||
|
||||
expect(selected?.id).toBe("coin_1000");
|
||||
|
||||
Reference in New Issue
Block a user