From 52178ba79d23297121c232e0ed6a76eb28f379a3 Mon Sep 17 00:00:00 2001 From: Bastian Wagner Date: Fri, 21 Aug 2026 15:46:28 +0200 Subject: [PATCH] test(api): make equip() re-anchor test exercise the overflow scenario The re-anchor test in equipment.service.spec.ts anchored hpRegenSince at null, which meant currentHp already equaled the old maxHp and nothing in equip() could change it whether settle() ran correctly, was a no-op, or read the wrong (post-change) maxHp. Anchor currentHp at 90 with hpRegenSince 600s before the harness's fixed clock so settle() must actually cap accumulated regen at the OLD maxHp for the assertion to hold, catching both failure modes the original fixture missed. --- apps/api/src/equipment/equipment.service.spec.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/api/src/equipment/equipment.service.spec.ts b/apps/api/src/equipment/equipment.service.spec.ts index 5e96426..a1628c9 100644 --- a/apps/api/src/equipment/equipment.service.spec.ts +++ b/apps/api/src/equipment/equipment.service.spec.ts @@ -431,7 +431,12 @@ describe('EquipmentService', () => { weaponDamage: 0, }); const { state, service } = createHarness({ - characters: [character({ currentHp: 100, hpRegenSince: null })], + characters: [ + character({ + currentHp: 90, + hpRegenSince: new Date('2026-08-18T08:50:00.000Z'), + }), + ], itemDefinitions: [bonusHpHelm], characterItems: [ {