feat : big update
This commit is contained in:
@@ -6,6 +6,7 @@ import {
|
||||
cleanLunarisText,
|
||||
constellationSnapshot,
|
||||
supportsWeaponType,
|
||||
talentSnapshot,
|
||||
} from "@/lib/catalog/lunaris";
|
||||
|
||||
describe("Lunaris character data", () => {
|
||||
@@ -19,6 +20,10 @@ describe("Lunaris character data", () => {
|
||||
expect(cleanLunarisText('"A {LINK#N1}<color=#fff>bright</color>{/LINK} morning"')).toBe("A bright morning");
|
||||
});
|
||||
|
||||
it("converts escaped Lunaris newlines into displayable lines", () => {
|
||||
expect(cleanLunarisText("First line\\n\\n<i>Second line</i>")).toBe("First line\n\nSecond line");
|
||||
});
|
||||
|
||||
it("normalizes constellation levels and icon keys", () => {
|
||||
const result = constellationSnapshot({
|
||||
constellations: {
|
||||
@@ -49,6 +54,22 @@ describe("Lunaris character data", () => {
|
||||
expect(detail.info?.element).toBe("Cryo");
|
||||
});
|
||||
|
||||
it("maps normal, skill, and burst talent metadata", () => {
|
||||
const detail = characterDetailSchema.parse({
|
||||
skills: {
|
||||
normalattack: { name: "Normal", description: "Line 1\\nLine 2", icon: "Skill_A_Test" },
|
||||
elementalskill: { name: "Skill", description: "Skill detail", icon: "Skill_S_Test" },
|
||||
elementalburst: { name: "Burst", description: "Burst detail", icon: "Skill_E_Test" },
|
||||
},
|
||||
});
|
||||
|
||||
expect(talentSnapshot(detail, (icon) => `${icon}.webp`)).toEqual([
|
||||
{ type: "NA", name: "Normal", description: "Line 1\nLine 2", iconKey: "Skill_A_Test.webp" },
|
||||
{ type: "E", name: "Skill", description: "Skill detail", iconKey: "Skill_S_Test.webp" },
|
||||
{ type: "Q", name: "Burst", description: "Burst detail", iconKey: "Skill_E_Test.webp" },
|
||||
]);
|
||||
});
|
||||
|
||||
it("matches only weapons supported by the character", () => {
|
||||
expect(
|
||||
supportsWeaponType("WEAPON_SWORD_ONE_HAND", "WEAPON_SWORD_ONE_HAND"),
|
||||
|
||||
Reference in New Issue
Block a user