https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
p

Pete Hellyer

10/12/2023, 1:51 PM
Hi All, I’m using preCompose to implement MVVM in shared code - does anyone have any experience in writing tests in the common module for viewModel where the fcn uses viewModelScope ?
m

Marko Novaković

10/12/2023, 2:04 PM
your best bet, in general, is not to use
viewModelScope
viewModelScope
is implemented like:
Copy code
CloseableCoroutineScope(SupervisorJob() + Dispatchers.Main.immediate)
Dispatchers.setMain()
isn’t working?
p

Pete Hellyer

10/12/2023, 2:11 PM
Nope, unless I am putting it somewhere silly, should I setMain at the start of the test proper, or in setup?
4 Views