This repository has been archived by the owner on Jun 22, 2022. It is now read-only.
Fix #42 flowOf doesn't respect the passed key. #43
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This Pull Request fixes #42.
It also adds flowOf tests to DBTests_04_Flows.kt.
Notes
I noticed something strange when writing the tests.
For some reason
keyById
(and by extension the stateFlowOfId tests) require the idvarargs
to be passed askeyById("Salomon", "BRYS")
instead of the way they are defined in thePerson
model, which isoverride val id get() = listOf(lastName, firstName)
I'm not sure if this is a bug. I think it's following the declaration order of the
data class
. I've changed the test forstateFlow
, this issue was hidden before because the key wasn't being compared by the listener, but the keys being generated in the listener'soperation
were different from what was being generated for the parameters passed tostateFlowOfId
.I'm happy to write some docs for
flowOf
if you wish, but I noticed that the docs on master are ahead of the docs on the website, so these flows weren't as undocumented as I thought, infact they are quite well documented!