Skip to content
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

Fix out of time use case virtual time tests #6842

Merged

Conversation

kl
Copy link
Contributor

@kl kl commented Sep 23, 2024

The awaitItem() method from Turbine is used which causes delays to be skipped. This causes some tests to behave incorrectly where we want to assert that a given value is emitted after a specific delay. The solution is to instead use the expectMostRecentItem() method when we want to assert that an item has been emitted at a given point in time.

Further reading:

https://medium.com/@hi.enricog/explore-testing-coroutines-with-runtest-by-examples-4c4274a86a83

cashapp/turbine#265


This change is Reviewable

@kl kl added the Android Issues related to Android label Sep 23, 2024
@kl kl requested a review from Rawa September 23, 2024 11:30
Copy link

linear bot commented Sep 23, 2024

Copy link
Contributor

@Pururun Pururun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r1, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@Rawa Rawa force-pushed the fix-outoftimeusecasetest-virtual-time-assertions-droid-1372 branch from f54eadb to bd75b90 Compare September 24, 2024 12:52
@Rawa Rawa force-pushed the fix-outoftimeusecasetest-virtual-time-assertions-droid-1372 branch from bd75b90 to fa5e858 Compare September 24, 2024 12:54
@Rawa Rawa merged commit 1fc8ebd into main Sep 24, 2024
24 checks passed
@Rawa Rawa deleted the fix-outoftimeusecasetest-virtual-time-assertions-droid-1372 branch September 24, 2024 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android Issues related to Android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants