refactor(data): replace schema classes with readonly models

This commit is contained in:
2026-07-17 13:21:40 +08:00
parent 3437312167
commit ae97366a4a
103 changed files with 1220 additions and 2117 deletions
@@ -2,12 +2,12 @@ import { act } from "react";
import { createRoot, type Root } from "react-dom/client";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { PaymentPlan } from "@/data/schemas/payment";
import { PaymentPlan, PaymentPlanSchema } from "@/data/schemas/payment";
import { behaviorAnalytics } from "@/lib/analytics";
import { usePaymentPlanAnalytics } from "../use-payment-plan-analytics";
const firstPlan = PaymentPlan.from({
const firstPlan = PaymentPlanSchema.parse({
planId: "plan-1",
planName: "Plan One",
orderType: "dol",
@@ -18,7 +18,7 @@ const firstPlan = PaymentPlan.from({
originalAmountCents: null,
currency: "USD",
});
const secondPlan = PaymentPlan.from({
const secondPlan = PaymentPlanSchema.parse({
planId: "plan-2",
planName: "Plan Two",
orderType: "dol",
@@ -43,8 +43,9 @@ describe("usePaymentPlanAnalytics", () => {
let root: Root;
beforeEach(() => {
(globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean })
.IS_REACT_ACT_ENVIRONMENT = true;
(
globalThis as { IS_REACT_ACT_ENVIRONMENT?: boolean }
).IS_REACT_ACT_ENVIRONMENT = true;
container = document.createElement("div");
document.body.appendChild(container);
root = createRoot(container);