import { describe, expect, it } from "vitest"; import { toMsCheckoutPublic } from "@/lib/mothership/ms-checkout-store"; describe("toMsCheckoutPublic", () => { it("不暴露 screenshot_path,失败文案脱敏", () => { const pub = toMsCheckoutPublic({ quote_id: "q1", status: "failed", message: "TimeoutError: page.click", screenshot_path: "/tmp/secret.png", updated_at_ms: 1, }); expect(pub).toEqual({ status: "failed", stage: null, selected_carrier: null, selected_total: null, coverage: null, cargo_value_usd: null, message: "官网同步失败,请稍后重试", }); expect(pub).not.toHaveProperty("screenshot_path"); }); it("done / processing 使用固定中文文案", () => { expect( toMsCheckoutPublic({ quote_id: "q1", status: "done", message: "raw rpa ok", updated_at_ms: 1, }).message, ).toBe("已在官网填齐详情(未支付)"); expect( toMsCheckoutPublic({ quote_id: "q1", status: "processing", message: "internal", updated_at_ms: 1, }).message, ).toMatch(/正在官网/); }); });