fix: address final-review findings (TopBar hydration, snapshot test, armor doc, inventory refresh test)
Fixes 4 Important findings from the final whole-branch review: - /inventory never called WorldStore.load(), leaving the TopBar stuck on "loading" and characterLevel() silently defaulting to 1 for any character above level 1. Mirrors the same guard already used in HuntPageComponent. - The combat/equipment snapshot-immutability integration test asserted only status/round, never the actual playerState snapshot the whole test claims to prove is untouched after a post-fight equip. - Documented (comment only, no behavior change) that the demo character's armor dropping from the old hardcoded 6 to 0 is an intentional, spec-sanctioned tradeoff (Slice 0.5 spec Section19), not a bug. - inventory.store.spec.ts's equip test used an identical inventory fixture before and after equip(), so a regression dropping the post-equip inventory re-fetch would still have passed. Now asserts the refetched fixture is actually reflected. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -367,6 +367,10 @@ describe('equipping Räuberklinge increases combat damage (spec §45, §60)', ()
|
||||
|
||||
await equipmentService.equip(CHARACTER_ID, BANDIT_BLADE_ITEM_ID);
|
||||
|
||||
// The finished combat's playerState snapshot (written once at startCombat)
|
||||
// must not be retroactively rewritten by equipping after the fight ends.
|
||||
expect(state.combats[0].playerState).toEqual({ attack: 6, weaponDamage: 8, armor: 0 });
|
||||
|
||||
const reloaded = await combatService.getCombat(CHARACTER_ID, combat.id);
|
||||
expect(reloaded.status).toBe(result.status);
|
||||
expect(reloaded.round).toBe(result.round);
|
||||
|
||||
@@ -217,6 +217,13 @@ export async function seedVisibleVerticalSlice(
|
||||
const characterItemRepository = dataSource.getRepository(CharacterItem);
|
||||
const characterEquipmentRepository = dataSource.getRepository(CharacterEquipment);
|
||||
|
||||
// Starting loadout is weapon-only -- no starter armor piece exists in
|
||||
// content yet -- so the demo character's effective armor (sum of equipped
|
||||
// bonusArmor) is 0 until the player loots and equips bandit-hood (+3
|
||||
// armor). This is a deliberate tradeoff, not a bug: Slice 0.5 spec §19
|
||||
// says to preserve the existing demo balance "as closely as the
|
||||
// implemented content allows" and explicitly forbids fabricating a full
|
||||
// starter gear set just to hit the old hardcoded TEMPORARY_ARMOR = 6.
|
||||
const existingStartingSword = await characterItemRepository.findOneBy({
|
||||
characterId: DEMO_CHARACTER_ID,
|
||||
itemDefinitionId: ITEM_IDS['worn-short-sword'],
|
||||
|
||||
Reference in New Issue
Block a user