in my `ViewModel` I’m not using `viewModelScope` b...
# getting-started
m
in my
ViewModel
I’m not using
viewModelScope
but I’m passing
coroutineScope
as a constructor argument. in tests I’m passing
UnconfinedTestDispatcher()
as
coroutimeScope
but my tests don’t work unless I do
Dispatchers.setMain(UnconfinedTestDispatcher())
even tho I’m not using
viewModelScope
. why is that?
s
If you're using
runTest
then calling
setMain
will also affect which dispatcher the code in the test itself is running on. Could that account for the difference?
m
indeed, I’m using
runTest