After this lesson you will
- Write an emission ledger: collector first, trigger, drain virtual time, and only then assert
- Choose StateFlow for renderable state and SharedFlow for one-time UI events
- Control Dispatchers.Main and QzDispatchers in tests so ViewModel tests can run in commonTest
Duration6 min
DifficultyIntermediate
Test Flows And ViewModels
Test state emissions without tapping the UI by hand.
- 01Lesson Goal
- 02Part 1: The Emission Ledger: StateFlow Or SharedFlow?
- 03Part 2: Control The Clock In ViewModel Unit Tests
- 04Part 3: A ViewModel Test That Runs On iOS
- 05Part 4: Test A ViewModel's Sequence Or Its Settled State
- 06Code Reading Path
- 07Signs To Avoid
- 08References
- 09Key Points
Topics: mobile-action-pro, release-readiness
9 sections left in this lessonUnlock all of Mobile Action ProLesson Goal, Part 1: The Emission Ledger: StateFlow Or SharedFlow?, … — plus 114 lessons in this course, source code and checklists.
Unlock Mobile Action ProOne-time payment — lifetime access — 7-day money-back. Already purchased? Sign in