Hello :wave:, I try to write integration test of s...
# test
o
Hello 👋, I try to write integration test of some
ViewModel
exposing an observable (here a
LiveData
but I guess it would be the same with any `Flow`(?)). I manage to write test checking the current value of such observable but I'd like to achieve something slightly more advanced but I can't manage so far. I'd like to check a sequence of such observable state updates. Say I have a
fun openData(file: File)
API, it will move my state from
Idle
to
Loading(file)
to
Loaded(data)
. I'd like to check such sequence. Given that I use the well known
getOrAwait()
helper and
InstantTaskExecutorRule
+
MainCoroutineRule
So far, either the state I get is still
Idle
or it's always the last one
Loaded
, I don't know how to collect the sequence and check something at each individual update. My understanding is that given that
getOrAwait
creates a whole new observer each time, it's immediately notified with current value.