31 lines
1.2 KiB
TypeScript
31 lines
1.2 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { parseLunarisVersion, weaponStatsFromLunaris } from "./catalog-stats";
|
|
import { formatBaseStat } from "./translator/stat-format";
|
|
|
|
describe("Lunaris catalog stats", () => {
|
|
it("reads the current version", () => {
|
|
expect(parseLunarisVersion({ version: "7.0.54.2", timestamp: 123 })).toBe("7.0.54.2");
|
|
});
|
|
|
|
it("maps level 90 weapon ascension stats by catalog ID", () => {
|
|
const stats = weaponStatsFromLunaris({
|
|
"11401": { enName: "Favonius Sword", ascensionStats: { "Energy Recharge%": 61.3, atk: 454 } },
|
|
"11509": { enName: "Mistsplitter Reforged", ascensionStats: { "CRIT DMG%": "44.1", atk: 674 } },
|
|
});
|
|
expect(stats.get("11401")).toEqual([
|
|
{ key: "atk", value: 454 },
|
|
{ key: "Energy Recharge%", value: 61.3 },
|
|
]);
|
|
expect(stats.get("11509")).toEqual([
|
|
{ key: "atk", value: 674 },
|
|
{ key: "CRIT DMG%", value: "44.1" },
|
|
]);
|
|
});
|
|
|
|
it("formats flat and percentage stats", () => {
|
|
expect(formatBaseStat({ key: "hp", value: 12397 })).toBe("HP 12,397");
|
|
expect(formatBaseStat({ key: "ER", value: "26.7" })).toBe("ER 26.7%");
|
|
expect(formatBaseStat({ key: "CRIT DMG%", value: "38.4" })).toBe("CRIT DMG 38.4%");
|
|
});
|
|
});
|