Marko Novaković
10/02/2023, 11:59 AMViewModel
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?Sam
10/02/2023, 12:07 PMrunTest
then calling setMain
will also affect which dispatcher the code in the test itself is running on. Could that account for the difference?Marko Novaković
10/02/2023, 12:08 PMrunTest