3 Commits

Author SHA1 Message Date
wangdl
203e45df34 test: remove View helper tests from ViewModel test file
- statusLabel/formatSeconds belong to MaterialDetailView, not ViewModel

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-18 13:15:26 +08:00
wangdl
833bc70121 test: add load() tests with mock service DI (IOS-INFO-035)
- Add service protocols (KnowledgeBaseServicing, KnowledgeItemServicing,
  QuizServicing, ReadingProgressServicing) for dependency injection
- ViewModel init accepts optional mock services, defaults to .shared
- Mock service classes for test isolation
- load() tests: itemCount, quizCount, aiStatus ready/processing,
  isLoading, readingStatus/seconds, isMarkedRead, progress error,
  nil materialId skips progress

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-18 13:14:49 +08:00
wangdl
61de3e1d57 test: add MaterialDetailViewModel unit tests (IOS-INFO-035)
- 20 tests covering initial state + helpers
- Initial state: isLoading, aiStatus, itemCount, quizCount, isMarkedRead,
  readingSeconds, readingStatus, knowledgeBaseId, materialId
- init without materialId defaults to nil
- statusLabel: completed/in_progress/unknown/nil → Chinese labels
- formatSeconds: seconds(0/30/59), minutes(60/3599), hours(3600/3660/7200)
- Edge: nil materialId skips progress fetch

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-18 13:11:36 +08:00