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

Basic unit tests for all sample-migration screens #287

Merged
merged 1 commit into from
Sep 27, 2023
Merged

Conversation

cmathew
Copy link
Contributor

@cmathew cmathew commented Sep 27, 2023

  • mock toolbar helper in tests
  • use setContentScreen where possible
  • configure Robolectric via properties file where possible

sdk=28
application=com.wealthfront.magellan.sample.migration.TestSampleApplication
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Robolectric will pick this up automatically since it's looking out for classes named "TestBlahApplication", but good to be explicit anyways

@@ -12,7 +13,8 @@ import com.wealthfront.magellan.navigation.NavigationPropagator
* Ideally, this dependency is provider by dependency injection and configured so that the views are cleaned up when the activity
* is destroyed with the help of (subcomponents & custom scopes)[https://dagger.dev/dev-guide/subcomponents].
*/
object ToolbarHelper : LifecycleAwareComponent(), NavigationListener {
@OpenForMocking
class ToolbarHelper : LifecycleAwareComponent(), NavigationListener {
Copy link
Contributor Author

@cmathew cmathew Sep 27, 2023

Choose a reason for hiding this comment

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

convert to instance so it can be injected, and therefore easily mocked in test

@cmathew cmathew merged commit 9d57a03 into master Sep 27, 2023
2 checks passed
@cmathew cmathew deleted the more-sample-tests branch October 27, 2023 20:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants