Skip to content

test: domain-layer characterization suite (25 -> 165 tests) - #2

Merged
jdluu merged 1 commit into
mainfrom
test/domain-characterization
Aug 26, 2026
Merged

test: domain-layer characterization suite (25 -> 165 tests)#2
jdluu merged 1 commit into
mainfrom
test/domain-characterization

Conversation

@jdluu

@jdluu jdluu commented Aug 26, 2026

Copy link
Copy Markdown
Owner

Summary

Phase 1 of the refactor plan (docs/plans/2026-08-25-comprehensive-refactor.md).

  • Characterization tests for every domain use case: CalculateTrainingLoad, DetectDeload, GetMuscleRecovery, GetWeeklyProgress, GetMuscleGroupProgress, GetPRDetails, CompareRoutineSessions, ExplainWorkout, ExportCoachReport, BuildAiContext
  • Exhaustive StatsCalculator + ExerciseTemplateMatcher coverage
  • Hand-written fakes preferred over mocks for logic-bearing collaborators
  • DIP fix: new AiContextProvider interface; BuildAiContextUseCase no longer depends on the concrete HevyAiDataAccessor; Hilt binding added; behavior unchanged
  • Tests found one suspicious behavior, encoded as-is with a NOTE comment: empty stored exercise titles shadow real templates on substring matching passes in ExerciseTemplateMatcher

Test Plan

  • ./gradlew testDebugUnitTest: 165/165 pass (was 25)
  • ./gradlew lintDebug: 0 errors
  • ./gradlew assembleDebug: success
  • CI green on this PR

- Add tests for all 10 domain use cases plus exhaustive coverage of
  StatsCalculator and ExerciseTemplateMatcher (25 -> 165 tests)
- Add shared hand-written fakes for repositories and AI client
- Add turbine and mockk test dependencies
- Extract AiContextProvider interface so BuildAiContextUseCase depends
  on an abstraction instead of the Hevy-specific accessor (DIP); bind
  via Hilt; test with a fake instead of mocking the concrete class
- Relocate StatsCalculatorTest from data.repository to domain.util to
  match the class under test
@jdluu
jdluu merged commit 1b138f6 into main Aug 26, 2026
3 checks passed
@jdluu
jdluu deleted the test/domain-characterization branch August 26, 2026 02:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant