Files
buzz-sheet/lib/guides/talents.test.ts
T
gunshiz 1d19961d8b
CI / Verify (push) Successful in 55s
CI / Build immutable images and deploy (push) Successful in 1m13s
feat: update
2026-09-01 16:31:05 +07:00

43 lines
1.6 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { normalizeTalentPriorities, reorderTalentPriorities, talentRelationSymbol, talentTypeLabel } from "@/lib/guides/talents";
describe("talent priorities", () => {
it("normalizes legacy talents to strict comparisons", () => {
expect(normalizeTalentPriorities([
{ type: "Q", priority: 2 },
{ type: "E", priority: 1 },
{ type: "NA", priority: 3 },
])).toEqual([
{ type: "E", priority: 1, relationToNext: "gt" },
{ type: "Q", priority: 2, relationToNext: "gt" },
{ type: "NA", priority: 3, relationToNext: undefined },
]);
});
it("reorders talents while preserving relations between positions", () => {
expect(reorderTalentPriorities([
{ type: "E", priority: 1, relationToNext: "gte" },
{ type: "Q", priority: 2, relationToNext: "gt" },
{ type: "NA", priority: 3 },
], "NA", "E")).toEqual([
{ type: "NA", priority: 1, relationToNext: "gte" },
{ type: "E", priority: 2, relationToNext: "gt" },
{ type: "Q", priority: 3, relationToNext: undefined },
]);
});
it("formats every supported talent relation", () => {
expect(talentRelationSymbol("gt")).toBe(">");
expect(talentRelationSymbol("gte")).toBe("≥");
expect(talentRelationSymbol("eq")).toBe("=");
expect(talentRelationSymbol()).toBe(">");
});
it("labels each talent type in Thai", () => {
expect(talentTypeLabel("NA")).toBe("ตีปกติ");
expect(talentTypeLabel("E")).toBe("สกิลธาตุ");
expect(talentTypeLabel("Q")).toBe("ท่าไม้ตาย");
});
});