Repository navigation
Items Test Plan
This page groups the existing automated tests for item creation, drops, pickup, inventory, consumables and merchant transactions. The cases below describe their purpose and asserted result.
Shared inventory and room components are included where they verify item integration. Their tests are referenced here without duplicating their implementation or changing the documentation for those systems.
Test classes: ItemCatalogTest, ItemDropSpecTest, LootTableTest and ItemFactoryTest.
These cover registered item IDs and metadata, quantity validation, independent charm instances, configured reward selection and world-entity construction.
| Test | Purpose | Expected Result |
|---|---|---|
ItemCatalogTest.multipleCharmsAreIndependentWhileConsumablesAndGoldRemainStacks |
Create multiple charms and stacked rewards through the catalogue. | Charms are distinct objects; consumables and Gold retain their requested stack quantities. |
LootTableTest.everyEnemyAndInternalSummonHasAnExplicitValidTable |
Check configured enemy and internal-summon rules. | Every required type has exactly one valid rule; the configured tables use one roll and a total weight of 100. |
LootTableTest.everyTableEntryCanBeRolledAtBothWeightBoundaries |
Select the first and last value in each configured reward interval. | Both boundaries resolve to the intended item and quantity. |
The loot tests also cover invalid and duplicate rules, the general fallback, custom healing IDs, and the explosive summon's 80% no-drop interval. These are deterministic checks of the configured selection intervals, not a statistical sampling result.
Test classes: CharmPickupComponentTest, EnemyLootPickupIntegrationTest, ItemPickupUseIntegrationTest and ItemDropAnimationComponentTest.
CharmPickupComponentTest retains its historical class name while testing the generic pickup path. Coverage includes overlap and range changes, explicit pickup requests, Gold quantities, prompt cleanup and item animation timing.
| Test | Purpose | Expected Result |
|---|---|---|
CharmPickupComponentTest.shouldNotPickUpOnRoomInteract |
Send the room/NPC interaction event while an item is nearby. | Interaction alone does not collect the item. |
EnemyLootPickupIntegrationTest.everyRegisteredRewardCanDropAndEnterTheRealInventory |
Create and collect each registered reward through the real item and inventory components. | Each reward reaches the correct storage, repeated pickup does not duplicate it, and the pickup prompt is cleared. |
Test classes: InventoryComponentTest, StrengthCharmTest, CharmEffectSummaryTest and EnemyLootPickupIntegrationTest.
These cover inventory quantities and notifications, independent charm ownership, effect summaries and equipment transitions.
| Test | Purpose | Expected Result |
|---|---|---|
InventoryComponentTest.charmEquipmentTransitionsApplyAndRemoveStatsExactlyOnce |
Equip, re-equip and unequip a charm. | Equipment applies its bonus once and unequipping removes that bonus without compounding repeated requests. |
InventoryComponentTest.shouldPublishCommittedPurchaseState |
Observe inventory notifications during a purchase. | Observers see the completed payment and stock update together. |
EnemyLootPickupIntegrationTest.allCharmTypesRemainIndependentAndEquipmentTransitionsRestoreEffectiveStats |
Collect and change equipment across all charm types. | Charm instances remain independent and equipment changes restore the expected effective stats. |
Test classes: ConsumableItemTest and ConsumableUseIntegrationTest.
Coverage includes item-specific validation, successful use consuming one unit, healing limits, player timed-effect refresh, composition with other stat changes, and cleanup on death or disposal.
| Test | Purpose | Expected Result |
|---|---|---|
ConsumableUseIntegrationTest.oneUseRequestHealsAndConsumesExactlyOnce |
Use one Small Health Potion from 50 HP, then request use without stock. | The successful request restores health to 75, consumes one unit and emits one success notification. The later request does not change health or stock. |
ConsumableUseIntegrationTest.fullHealthDoesNotConsumeAnyInstantPotionSize |
Try each instant healing size at maximum health. | Use is rejected and the potion remains in inventory. |
ConsumableUseIntegrationTest.strengthRefreshDoesNotCompoundOrRemoveNewCharm |
Refresh Strength Potion while charm equipment changes. | The potion multiplier does not compound and removing its effect preserves the charm contribution. |
Test classes: FreezeBombUseTest, BurnVialUseIntegrationTest, BurnVialTest, MagnetUseIntegrationTest and MagnetPotionTest.
Coverage includes eligible on-screen targets, required service checks, Burn's independent effects and damage, and Magnet's range, duration, item filtering and collection lifecycle.
| Test | Purpose | Expected Result |
|---|---|---|
FreezeBombUseTest.selectedBombFreezesOnlyVisibleEnemiesAndUsesOneItem |
Use the selected Freeze Bomb with enemies inside and outside the visible area. | Eligible visible enemies are frozen and one bomb is consumed. |
MagnetUseIntegrationTest.realFactoryDropsAreCollectedOnceAndUnregisteredAfterTheUpdate |
Attract real factory-created Gold and consumables alongside a charm and distant Gold. | Seven Gold and two Burn Vials are collected once. The charm and distant Gold remain unaffected, and collected entities are unregistered after the update. |
Test classes: ConsumableSelectionComponentTest, ConsumableHotbarDisplayTest, InventoryDisplayTest, InventoryDisplayLayeringTest and InventoryComponentTest.
These test the four consumable slots, selected-item display, use requests, backpack stock, book equipment actions, drag operations and input/layering behaviour. ConsumableHotbarDisplayTest is the implementation's test-class name; the feature is documented in Consumable Slots.
| Test | Purpose | Expected Result |
|---|---|---|
ConsumableHotbarDisplayTest.tabWrapsAllFourSlotsAndUpdatesHighlightEvenWhenEmpty |
Cycle through all four slot positions, including empty slots. | Selection wraps and the highlight follows the selected position. |
InventoryDisplayTest.realDragOntoOccupiedSlotSwapsAssignmentsWithoutLosingStock |
Drag a consumable onto an occupied slot. | The two assignments swap while the three Health Potions and two Shields retain their quantities. |
Test classes: ShopCatalogTest, ShopServiceTest, CharmPurchaseEffectTest, ShopSessionComponentTest, ShopInputComponentTest and ShopFactoryTest.
Coverage includes offered item IDs and prices, invalid purchases, Gold and ownership changes, dialogue-to-shop transitions, input handling and release of the session's own locks.
| Test | Purpose | Expected Result |
|---|---|---|
ShopCatalogTest.shouldOfferEveryRegisteredConsumableAndCharmExactlyOnce |
Build the default merchant catalogue. | Each registered consumable and charm has exactly one offer. |
CharmPurchaseEffectTest.bothEventsObserveCompletedPaymentAndOwnership |
Observe goldChanged and charmAdded during a charm purchase. |
Both notifications expose the completed payment and charm ownership. |
ShopInputComponentTest.shouldNotBuyFromFinalDialogueClick |
Simulate a narrative-priority click that opens the shop. | The opening click is consumed before reaching the shop stage, preventing click-through. |
Test classes: CoinFlipGameTest, GambleServiceTest, ItemGambleConfigTest and ShopFactoryTest.
These cover stake validation, wins and losses, weighted reward selection, no-reward outcomes, invalid reward or overflow handling, and repeated input during the game display.
| Test | Purpose | Expected Result |
|---|---|---|
CoinFlipGameTest.winAndLossUseTheSameInventoryAndExactStake |
Resolve a win and a loss using the player's inventory. | Both outcomes use the configured stake and update that same Gold balance correctly. |
GambleServiceTest.normalBustChargesOnceWithoutGrantingItems |
Resolve an Item Draw with no reward. | The draw cost is charged once and no item is granted. |
ShopFactoryTest.itemDrawSettlesOnceAndHiddenGamesCannotCharge |
Repeat input during an Item Draw and interact with hidden game controls. | The draw settles once; repeated or hidden controls do not charge the draw cost again. |