-
Notifications
You must be signed in to change notification settings - Fork 662
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
Update FakeFormActivityLauncher and FakeManageActivityLauncher to use turbines #9957
base: master
Are you sure you want to change the base?
Conversation
launchArgs = input | ||
_launchStateTurbine.add( | ||
LaunchState( | ||
didLaunch = true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can remove this from the launch state. It'll only be emitted if the launch was called.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should still be possible!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
private val _launchStateTurbine = Turbine<LaunchState>() | ||
val launchTurbine: ReceiveTurbine<LaunchState> = _launchStateTurbine | ||
private val _unregisterTurbine = Turbine<Boolean>() | ||
val unregisterTurbine: ReceiveTurbine<Boolean> = _unregisterTurbine |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could probably even just replace this with Unit
instead of Boolean
. We don't really care about the value. Just that a value was emitted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to Unit
private set | ||
var didUnregister = false | ||
private set | ||
private val _launchStateTurbine = Turbine<LaunchState>() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's probably a not terrible way to make these generic, and not need 2 of basically the same implementations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to pair on it if you want!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added generic FakeEmbeddedActivityLauncher
Diffuse output:
APK
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
import app.cash.turbine.ReceiveTurbine | ||
import app.cash.turbine.Turbine | ||
|
||
internal class FakeEmbeddedActivityLauncher<T>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In theory there is nothing embedded specific about this. Are there any other mocks we could remove and replace with this instead (in a follow up)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Created a follow up ticket https://jira.corp.stripe.com/browse/MOBILESDK-3041
Summary
Replace class vars with turbines for better testing
Motivation
https://jira.corp.stripe.com/browse/MOBILESDK-3029
Testing