This might have been asked before but I could not ...
# coroutines
c
This might have been asked before but I could not find much info: Are there any testing utilities for testing Flows? I want to do things like assert the "initial" value of a Flow, perform some action and then assert that the flow emitted another value
d
You can use
produceIn
to achieve this. Get the channel and receive items imperatively.
l
Also, don't forget to close the channel using
consume { … }
or
cancel()
. I spent quite some time wondering why they would deadlock, and it was because the channel producer would be kept alive, preventing the coroutine scope from completing.
✔️ 2
c
That worked like a charm. Thanks!