https://kotlinlang.org logo
#test
Title
# test
f

Florian Walther (live streaming)

01/01/2022, 12:03 PM
I'm trying to test a LiveData using the
getOrAwaitValue
helper function from the Google samples. But this LiveData is coming from a
MutableStateFlow
using
asLiveData
. There seems to be a race condition and I am not getting a value in my test. I've tried passing the
StandardTestDispatcher
to
asLiveData
but it didn't change anything.
It works if I use
UnconfinedTestDispatcher
instead of
StandardTestDispatcher
23 Views