58 lines
2.8 KiB
TypeScript
58 lines
2.8 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
PARTY_TALENT_SPECIALIZATIONS,
|
|
partyTalentRanksForLevel,
|
|
} from "./partyTalents";
|
|
import {
|
|
runtimePartyTalentProvenanceForLevel,
|
|
runtimePartyTalentProfiles,
|
|
runtimePartyTalentRanksForLevel,
|
|
} from "./partyTalentRuntime";
|
|
|
|
describe("generated party talent runtime plans", () => {
|
|
it("keeps the prior catalog-validated authoring plans as named profiles", () => {
|
|
for (const { classId, specialization } of PARTY_TALENT_SPECIALIZATIONS) {
|
|
const executable = runtimePartyTalentProfiles(classId, specialization)
|
|
.find((profile) => profile.source === "healer-man-generated");
|
|
expect(executable).toBeDefined();
|
|
for (let level = 1; level <= 80; level += 1) {
|
|
expect(runtimePartyTalentRanksForLevel(classId, specialization, level, executable!.id)).toEqual(
|
|
partyTalentRanksForLevel(classId, specialization, level),
|
|
);
|
|
}
|
|
}
|
|
}, 15_000);
|
|
|
|
it("provides a default Playerbots profile and a distinct character for every build", () => {
|
|
const names = new Set<string>();
|
|
for (const { classId, specialization } of PARTY_TALENT_SPECIALIZATIONS) {
|
|
const profiles = runtimePartyTalentProfiles(classId, specialization);
|
|
expect(profiles).toHaveLength(2);
|
|
const playerbots = profiles.find((profile) => profile.defaultForSpecialization);
|
|
expect(playerbots?.source).toBe("azerothcore-playerbots");
|
|
expect(playerbots?.sourceVersion).toBe("531282e");
|
|
expect(playerbots?.milestones.length).toBeGreaterThan(0);
|
|
expect(playerbots?.levelPlans.length).toBe(playerbots?.milestones.length);
|
|
expect(playerbots?.levelPlans[0]?.minimumLevel).toBe(1);
|
|
expect(playerbots!.sourcePointsRetained).toBeLessThanOrEqual(playerbots!.sourcePointCount!);
|
|
expect(playerbots!.sourcePointsRetained! + playerbots!.fallbackPointCount).toBe(71);
|
|
const level79 = runtimePartyTalentProvenanceForLevel(playerbots!, 79);
|
|
const level80 = runtimePartyTalentProvenanceForLevel(playerbots!, 80);
|
|
expect(level79.sourceLevels[0]).toBeLessThanOrEqual(79);
|
|
expect(level80.sourceLevels).toEqual([80]);
|
|
expect(level79.sourcePointsRetained! + level79.fallbackPointCount).toBe(70);
|
|
expect(level80.sourcePointsRetained! + level80.fallbackPointCount).toBe(71);
|
|
for (const profile of profiles) {
|
|
expect(names.has(profile.characterName)).toBe(false);
|
|
names.add(profile.characterName);
|
|
for (const level of [1, 10, 20, 40, 60, 70, 79, 80]) {
|
|
const ranks = runtimePartyTalentRanksForLevel(classId, specialization, level, profile.id);
|
|
expect(Object.values(ranks).reduce((total, rank) => total + rank, 0))
|
|
.toBe(Math.max(0, level - 9));
|
|
}
|
|
}
|
|
}
|
|
expect(names.size).toBe(PARTY_TALENT_SPECIALIZATIONS.length * 2);
|
|
});
|
|
});
|