From 688c4cf70ff751ddded7e6a18a54d7dbdfa27511 Mon Sep 17 00:00:00 2001 From: Bastian Wagner Date: Fri, 21 Aug 2026 18:16:53 +0200 Subject: [PATCH] test(inventory): cover the non-equippable branch of the detail panel MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The panel's three-way actions block had no test for its middle branch: an item with equipmentSlot null should show "Nicht ausrüstbar" and no equip button. The gap predates this slice -- Task 14's review found it while confirming the removed level gate had not cost coverage. Deferred until now on purpose: the web bundle could not compile for the whole slice, so committing this earlier would have meant shipping a test I had never executed. Load-bearing: dropping the !isEquippable() guard would fall through to the else branch and render the button, failing the assertion. Co-Authored-By: Claude Opus 5 --- .../inventory-detail-panel.component.spec.ts | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/apps/web/src/app/features/inventory/inventory-detail-panel.component.spec.ts b/apps/web/src/app/features/inventory/inventory-detail-panel.component.spec.ts index bf0e3f3..451296e 100644 --- a/apps/web/src/app/features/inventory/inventory-detail-panel.component.spec.ts +++ b/apps/web/src/app/features/inventory/inventory-detail-panel.component.spec.ts @@ -37,6 +37,23 @@ const banditBlade: InventoryItem = { }, }; +const ashPelt: InventoryItem = { + id: 'item-pelt', + quantity: 3, + equipped: false, + item: { + key: 'ash-pelt', + name: 'Aschenfell', + rarity: 'COMMON', + equipmentSlot: null, + weaponDamage: 0, + bonusAttack: 0, + bonusHp: 0, + bonusArmor: 0, + iconPath: '/images/items/ash-pelt.png', + }, +}; + async function setup(overrides: { item?: InventoryItem | null; equippedItemInSlot?: InventoryItem | null; @@ -66,6 +83,15 @@ describe('InventoryDetailPanelComponent', () => { expect(element.querySelector('[data-detail-equip]')).toBeNull(); }); + it('refuses to offer an equip button for a non-equippable item', async () => { + const fixture = await setup({ item: ashPelt }); + const element = fixture.nativeElement as HTMLElement; + + expect(element.textContent).toContain('Nicht ausrüstbar'); + expect(element.querySelector('[data-detail-equip]')).toBeNull(); + expect(element.querySelector('[data-detail-equipped]')).toBeNull(); + }); + it('shows the stat comparison against the equipped item in the same slot', async () => { const fixture = await setup({ item: banditBlade, equippedItemInSlot: wornSword }); const text = (fixture.nativeElement as HTMLElement).querySelector('[data-detail-stats]')?.textContent ?? '';