Who can help me with next: how can I test the emit...
# coroutines
v
Who can help me with next: how can I test the emitted value from
MutableSharedFlow
which uses debounce? Example: I’m using this flow to track the input text in textfield, debounce and distinct it, and if it passes I make some calculations. But if in unit test I emit the value, it never enters the
collectLatest {}
lambda.
m
I’ve not played with this, but I would guess using
TestCoroutineScheduler
that supports fake time, and I would recommend using the library Turbine to make it easier. Basically advance time and then see if something is emitted.
v
I’m using the rule with
TestCoroutineScheduler
. Also, I don’t have the direct access to the flow reference, it just listens to the stream and when it collects, I do the next steps.
I tried
advanceUntilIdle
, but it doesn’t help as well