how to work with a flow that doesn't emit any value? #170
Unanswered
AlexanderKott
asked this question in
Q&A
Replies: 1 comment 3 replies
-
You can't really assert that a Flow will never emit an item. The best you can do is test that it has not yet emitted an item (with |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
hello, thank you for this awesome library!
Can you tell me how to test flows that dont emit any values?
i have 3 flows:
val displayText = MutableSharedFlow<String?>()
val displayButtons = MutableSharedFlow<String?>()
val displayItemMessage = MutableSharedFlow<String?>()
...
My Test:
so i want to ensure turbine3 doen't have any values (nothing emmited) and continue my test. Now test just fails
for turbine 3 : java.lang.AssertionError: No value produced in 1s if i write
assertEquals(" -- ", turbine3.awaitItem() )
thank you!
Beta Was this translation helpful? Give feedback.
All reactions