Background
Three tests in GraphLoaderProgressiveTest were added to cover the midnight boundary watcher behavior, but each reimplements the watcher loop locally rather than exercising StelekitViewModel.startMidnightBoundaryWatcher directly. This means a regression in the production wiring would not be caught.
Flagged during review of #108.
Affected tests
GraphLoaderProgressiveTest ~line 749 — watcher loop test duplicates production logic
GraphLoaderProgressiveTest ~line 782 — cancellation test verifies a local coroutine, not the real watcher
GraphLoaderProgressiveTest ~line 820 — lastJournalDate guard reimplemented locally; production guard bypass goes undetected
What needs to change
Extract a testable interface (or use dependency injection) so these tests can:
- Call
StelekitViewModel.startMidnightBoundaryWatcher (or an injected equivalent)
- Observe
JournalService.ensureTodayJournal() calls via a fake/stub
- Verify the real guard (
lastJournalDate) is skipping or firing correctly across midnight boundaries
Acceptance criteria
- Each of the three tests fails if the production
startMidnightBoundaryWatcher is deleted or broken
- No local reimplementation of the watcher loop in the test body
Background
Three tests in
GraphLoaderProgressiveTestwere added to cover the midnight boundary watcher behavior, but each reimplements the watcher loop locally rather than exercisingStelekitViewModel.startMidnightBoundaryWatcherdirectly. This means a regression in the production wiring would not be caught.Flagged during review of #108.
Affected tests
GraphLoaderProgressiveTest~line 749 — watcher loop test duplicates production logicGraphLoaderProgressiveTest~line 782 — cancellation test verifies a local coroutine, not the real watcherGraphLoaderProgressiveTest~line 820 —lastJournalDateguard reimplemented locally; production guard bypass goes undetectedWhat needs to change
Extract a testable interface (or use dependency injection) so these tests can:
StelekitViewModel.startMidnightBoundaryWatcher(or an injected equivalent)JournalService.ensureTodayJournal()calls via a fake/stublastJournalDate) is skipping or firing correctly across midnight boundariesAcceptance criteria
startMidnightBoundaryWatcheris deleted or broken