generated from nhcarrigan/template
feat: goddess sync, sanitize, and apotheosis init (chunk 3)
- initialState: add initialGoddessState() with all goddess sub-objects - apotheosis: init GoddessState on first apotheosis, preserve on subsequent - game: add goddessSpread block in validateAndSanitize (server-only fields capped, forward-only boss/quest/achievement enforcement) - debug: add injectMissingGoddessExplorationAreas helper and inject all 8 goddess content arrays in syncNewContent - vitest.config.ts: remove 8 goddess data files from coverage exclude (now imported via initialState) - tests: full coverage for all new code (482 tests, 100% coverage)
This commit is contained in:
@@ -112,4 +112,40 @@ describe("buildPostApotheosisState", () => {
|
||||
const { updatedState } = buildPostApotheosisState(state, "T");
|
||||
expect(updatedState.apotheosis?.count).toBe(1);
|
||||
});
|
||||
|
||||
it("initialises goddess state on first apotheosis (count goes to 1)", () => {
|
||||
const state = makeMinimalState();
|
||||
const { updatedState } = buildPostApotheosisState(state, "T");
|
||||
expect(updatedState.goddess).toBeDefined();
|
||||
});
|
||||
|
||||
it("preserves existing goddess state on second apotheosis (count goes to 2)", () => {
|
||||
const goddessState: GameState["goddess"] = {
|
||||
achievements: [],
|
||||
baseClickPower: 1,
|
||||
bosses: [],
|
||||
consecration: { count: 0, divinity: 0, productionMultiplier: 1, purchasedUpgradeIds: [] },
|
||||
disciples: [],
|
||||
enlightenment: { count: 0, purchasedUpgradeIds: [], stardust: 0, stardustCombatMultiplier: 1, stardustConsecrationDivinityMultiplier: 1, stardustConsecrationThresholdMultiplier: 1, stardustMetaMultiplier: 1, stardustPrayersMultiplier: 1 },
|
||||
equipment: [],
|
||||
exploration: { areas: [], craftedCombatMultiplier: 1, craftedDivinityMultiplier: 1, craftedPrayersMultiplier: 1, craftedRecipeIds: [], materials: [] },
|
||||
lastTickAt: 0,
|
||||
lifetimeBossesDefeated: 0,
|
||||
lifetimePrayersEarned: 0,
|
||||
lifetimeQuestsCompleted: 0,
|
||||
quests: [],
|
||||
totalPrayersEarned: 0,
|
||||
upgrades: [],
|
||||
zones: [],
|
||||
};
|
||||
const state = makeMinimalState({ apotheosis: { count: 1 }, goddess: goddessState });
|
||||
const { updatedState } = buildPostApotheosisState(state, "T");
|
||||
expect(updatedState.goddess).toEqual(goddessState);
|
||||
});
|
||||
|
||||
it("does not add goddess when count goes to 2 but no goddess exists on current state", () => {
|
||||
const state = makeMinimalState({ apotheosis: { count: 1 } });
|
||||
const { updatedState } = buildPostApotheosisState(state, "T");
|
||||
expect(updatedState.goddess).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user