Joseph Hawkes-Cates
06/15/2023, 10:44 PMsample
flow operator on a flow that I’m collecting on init of a class. When I do this my unit tests on this class hang and never complete. I am setting the main Dispatcher to an UnconfinedTestDispatcher
for my tests and injecting that main dispatcher into my class to use for it’s coroutine scope which has so far been sufficient, but sample
seems to break this. Any ideas for how to work around this?Joseph Hawkes-Cates
06/23/2023, 2:58 PMdarkmoon_uk
01/11/2024, 12:46 AMviewModelScope
.
I ended up exposing an optional backgroundScope
construction parameter in my ViewModel to support testing, with a default of null
that internal logic coalesces to the original viewModelScope
, a bit 🤢 since I never like it when testing requirements impact the way I code for runtime, but it works.