1.5 KiB
1.5 KiB
Plan: Issue #108 - Test Coverage Gaps
Summary
Add comprehensive tests for the modifier system (cache behavior, accumulation, type safety), integration tests (attribute change -> damage monitor recalculation), and ViewModel-like unit tests for save/load/error paths. Also add UI tests for edit dialog validation.
Implementation Steps
-
ModifierSystemTest.kt - Tests for:
- ModifierCache LRU eviction (max 5 entries)
- ModifierCache cache hit behavior
- AttributeModifier application to Attributes
- accumulateModifiers fold for DiceRoll
- Type safety of modifier interfaces
-
IntegrationTest.kt - Tests for:
- Attribute change -> DamageMonitor max value recalculation
- Full character round-trip: create, modify attributes, verify derived values
- Serialization round-trip preserving modifier behavior
-
CharacterViewModelTest.kt - Tests for:
- Save/serialize path (DataLoader.serialize)
- Load/deserialize path with valid JSON
- Error handling on malformed JSON (falls back to EXAMPLE_CHARACTER)
- Character update transform function
-
EditDialogValidationTest.kt - Tests for:
- CharacterData validation (checking field constraints)
- Attribute edit value bounds
AC Verification Checklist
- ViewModel tests for save/load/error paths
- Integration test: modify attribute -> verify damage monitor updates
- Modifier system tests: cache hits, accumulation, type safety
- UI tests for edit dialogs with validation
- Test coverage report available (document how to generate)