android-viewmodel

Unit test the new Kotlin coroutine StateFlow

删除回忆录丶 提交于 2020-12-05 06:55:26
问题 Recently was introduced the class StateFlow as part of Kotlin coroutine. I'm currently trying it and encounter an issue while trying to unit test my ViewModel. What I want to achieve: testing that my StateFlow is receiving all the state values in the correct order in my ViewModel. My code is as follow: ViewModel: class WalletViewModel(private val getUserWallets: GetUersWallets) : ViewModel() { val userWallet: StateFlow<State<UserWallets>> get() = _userWallets private val _userWallets: