Write unit test for stateFlow

Viewed 100

How can I write a unit test for Stateflow in the ViewModel

Stateflow in ViewModel:

private fun fetchLocation() {

    viewModelScope.launch {

       interactions.getLocation.invoke().collect {
            locationFlow.value = it
        }
    }
}

val getLocation: StateFlow<String?> = locationFlow
0 Answers
Related