-
Notifications
You must be signed in to change notification settings - Fork 991
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
NT-1738: Android Segment Refactor: Create TestApplicationModule #1074
Conversation
… one used un production code - use ApplicationProvider.getApplicationContext() instead of the deprecated this.application = (TestKSApplication) in test Application - migrated KSRoboelectricTestCase to kotlin - Protect the inicialization of multiple libraries/lifecycles for not being triggered on Testing
- add again fix date
…ne.forID("EST") as valid timezoneid
@@ -154,6 +156,8 @@ public void testProjectsForBottomSheet_WithManyProjects() { | |||
|
|||
@Test | |||
public void testProjectSwitcherProjectClickOutput() { | |||
DateTimeUtils.setCurrentMillisFixed(new DateTime().getMillis()); |
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 is needed for the test to keep working, it was done before on KSRobolectricTestCase.java:51 it has been isolated just for the concrete test.
val lakeTrackingClient = lakeTrackingClient(mockCurrentConfig, experimentsClientType) | ||
|
||
val component = DaggerApplicationComponent.builder() | ||
.applicationModule(TestApplicationModule(application())) |
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 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.
Great job! This is awesome 🎉
📲 What
ApplicationProvider
instead of deprecatedRuntimeEnvironment.application;
KSApplication.java
when running unit tests.2.9.3
is not the newest one, but the latest one we can use without changing any test.🤔 Why
The
ApplicationModule
was used on RobolectricTestCase for populating the environment object, instanciating all the third party libraries, later on that environment object was reloaded with all the mock clients. Avoid that first initialization by using the newTestApplicaionModule
📋 QA
Story 📖
NT-1738: Create TestApplication Module