Files
healer-man/src/game/talentUiCatalog.test.ts
T
2026-09-09 11:21:33 -04:00

30 lines
1.6 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { TALENT_NODES, TALENT_TREES } from "./talentCatalog";
import { loadedTalentUiCatalog, loadTalentUiCatalog, talentUiArtUrls, talentUiNodesForTree } from "./talentUiCatalog";
describe("talent UI catalog shards", () => {
it.each(["warrior", "barbarian"] as const)("loads only the %s class projection", async (classId) => {
const catalog = await loadTalentUiCatalog(classId);
const sourceTrees = TALENT_TREES.filter((tree) => tree.classId === classId);
const sourceTreeIds = new Set(sourceTrees.map((tree) => tree.id));
const sourceNodes = TALENT_NODES.filter((node) => sourceTreeIds.has(node.treeId));
expect(catalog.classId).toBe(classId);
expect(catalog.trees.map((tree) => tree.id)).toEqual(sourceTrees.map((tree) => tree.id));
expect(catalog.nodes.map((node) => node.id)).toEqual(sourceNodes.map((node) => node.id));
expect(catalog.nodes.every((node) => !("rankEffects" in node))).toBe(true);
for (const tree of catalog.trees) {
expect(talentUiNodesForTree(catalog, tree.id).every((node) => node.treeId === tree.id)).toBe(true);
}
});
it("returns each Priest talent artwork URL once", async () => {
const catalog = await loadTalentUiCatalog("priest");
const urls = talentUiArtUrls(catalog);
expect(loadedTalentUiCatalog("priest")).toBe(catalog);
expect(urls).toHaveLength(new Set(urls).size);
expect(urls).toContain("/assets/ui/talents/backgrounds/talent_priest1.png");
expect(urls).toContain("/assets/ui/talents/icons/spell_holy_powerwordshield.png");
});
});