New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default state isn't emitted in tests #86
Comments
does the default state is not emitting anymore? |
Not on v1.0.10 in the provided MWE. |
If you look at the current implementation https://github.com/uniflow-kt/uniflow-kt/blob/master/uniflow-android/src/main/java/io/uniflow/android/livedata/LiveDataPublisher.kt#L25 default state is just set as |
exact yes, it was the point that the first default state to be set is never emitted. Perhaps is something we could allow to setup. @erikhuizinga is it a 1.0.10 only change? then we can revert |
I tested the versions affected: ✅ 1.0.4 is the last version that passes the test. Either revert the change or make the states live data emit the initial state, which is for the observer to handle. I would say that always emitting the initial state is logical, because what's the use otherwise? |
yes clearly. @MarcinChrapowicz any thought on that? |
Ok, let's go for this then 👍 @MarcinChrapowicz will tell us if needed |
(Also reported through the Kotlin language Slack here.)
The testing docs (https://github.com/uniflow-kt/uniflow-kt/blob/master/doc/testing.md) suggest that it might be possible to test the default
UIState
of aDataFlow
. In fact, on UniFlow 0.11.6 the following test passes, but on v1.0.10 it fails! This is unexpected and possibly even a bug! The suggestion is to also emit the default state for testing purposes, as this is likely what the user intends to test.MWE:
The text was updated successfully, but these errors were encountered: