feat(sprint1-step3): PrestigePanel + MilestoneBar + équilibrage générateurs fixes
This commit is contained in:
@@ -11,6 +11,50 @@ import {
|
||||
DEFAULT_GENERATORS,
|
||||
} from "../core/economy";
|
||||
|
||||
// PrestigePanel visibility guard — canPrestige drives render condition
|
||||
// Ces tests valident l'invariant : le panneau prestige ne doit jamais être
|
||||
// visible (canPrestige = false) si les ressources sont inférieures au seuil.
|
||||
describe("PrestigePanel visibility (canPrestige guard)", () => {
|
||||
it("canPrestige = false pour resources = 0 → panneau non visible", () => {
|
||||
expect(canPrestige({ ...DEFAULT_STATE, resources: 0 })).toBe(false);
|
||||
});
|
||||
|
||||
it("canPrestige = false pour resources = 999 999 → panneau non visible", () => {
|
||||
expect(canPrestige({ ...DEFAULT_STATE, resources: 999_999 })).toBe(false);
|
||||
});
|
||||
|
||||
it("canPrestige = true pour resources = 1 000 000 → panneau visible", () => {
|
||||
expect(canPrestige({ ...DEFAULT_STATE, resources: 1_000_000 })).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("applyPrestige — post-prestige state", () => {
|
||||
const prestigeState = {
|
||||
...DEFAULT_STATE,
|
||||
resources: 1_500_000,
|
||||
generators: DEFAULT_STATE.generators.map((g) => ({ ...g, owned: 3 })),
|
||||
prestigeCount: 0,
|
||||
prestigeMultiplier: 1,
|
||||
};
|
||||
|
||||
it("ressources = 0 après prestige", () => {
|
||||
expect(applyPrestige(prestigeState).resources).toBe(0);
|
||||
});
|
||||
|
||||
it("multiplicateur = 1.1 après premier prestige", () => {
|
||||
expect(applyPrestige(prestigeState).prestigeMultiplier).toBeCloseTo(1.1);
|
||||
});
|
||||
|
||||
it("tous les générateurs owned = 0 après prestige", () => {
|
||||
const result = applyPrestige(prestigeState);
|
||||
expect(result.generators.every((g) => g.owned === 0)).toBe(true);
|
||||
});
|
||||
|
||||
it("prestigeCount incrémenté à 1 après premier prestige", () => {
|
||||
expect(applyPrestige(prestigeState).prestigeCount).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("generatorCost", () => {
|
||||
it("retourne baseCost quand owned = 0", () => {
|
||||
const gen = { ...DEFAULT_GENERATORS[0], owned: 0 };
|
||||
|
||||
Reference in New Issue
Block a user