Files
ShadowrunCharSheet/.plan/issue-108-test-coverage.md

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

  1. 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
  2. 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
  3. 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
  4. EditDialogValidationTest.kt - Tests for:

    • CharacterData validation (checking field constraints)
    • Attribute edit value bounds

AC Verification Checklist

  1. ViewModel tests for save/load/error paths
  2. Integration test: modify attribute -> verify damage monitor updates
  3. Modifier system tests: cache hits, accumulation, type safety
  4. UI tests for edit dialogs with validation
  5. Test coverage report available (document how to generate)