如何在 ViewModel 中为 Stateflow 编写单元测试
ViewModel 中的状态流:
private fun fetchLocation() {
viewModelScope.launch {
interactions.getLocation.invoke().collect {
locationFlow.value = it
}
}
}
val getLocation: StateFlow<String?> = locationFlow