import { describe, expect, it } from "vitest"; import { formatGuideValidationIssues } from "@/lib/guides/validation-messages"; describe("guide validation messages", () => { it("turns a raw weapon path into an actionable message", () => { expect(formatGuideValidationIssues("weapon", [{ path: ["rows", 5, "weaponKey"], message: "Invalid input" }])).toEqual([ "อาวุธอันดับ 6: กรุณาเลือกอาวุธ", ]); }); it("keeps specific Thai schema messages with a useful item label", () => { expect(formatGuideValidationIssues("team", [{ path: ["teams", 1, "members"], message: "Team ต้องมีตัวละครไม่ซ้ำกัน 4 ตัว" }])).toEqual([ "Team 2: Team ต้องมีตัวละครไม่ซ้ำกัน 4 ตัว", ]); }); it("uses the authored team name when one is available", () => { expect(formatGuideValidationIssues( "team", [{ path: ["teams", 1, "combo"], message: "Invalid input" }], { teamNames: ["First team", "Hypercarry"] }, )).toEqual(["Hypercarry: กรุณากรอก Combo"]); }); });