Repository navigation
Configures Koin on project - #11
Conversation
3131efd to
773c19e
Compare
|
I know it. Dropped from 100% of coverage. |
c0ecfed to
1b6715b
Compare
victorolinasc
left a comment
There was a problem hiding this comment.
Everything is quite nice! The only thing that worries me is that the TestSocialApp is not just "overriding" what we want in the test but also bootstrapping a completely different global Koin instance. I think this can be improved for the test only re-configuring what it needs.
| app.initKoin(newValue) | ||
|
|
||
| // Act | ||
| val activity = Robolectric.setupActivity(MainActivity::class.java) |
There was a problem hiding this comment.
This seems more like an arrange as well... I know that in this case we would end up with an empty Act comment, but you are not actually doing nothing in the Activity so it should be explicit that there is no action for the assertions below.
| val activity = Robolectric.setupActivity(MainActivity::class.java) | ||
|
|
||
| // Assert | ||
| assertThat(activity).isNotNull() |
There was a problem hiding this comment.
I don't think there is much value in this assertion. If it is null it will fail on the line below with a very clear NPE so I'd just skip this assertion.
| import org.koin.android.ext.android.startKoin | ||
| import org.koin.dsl.module.applicationContext | ||
|
|
||
| class TestSocialApp : Application() { |
There was a problem hiding this comment.
There is one thing here which worries me a bit: your test application has nothing to do with your production application. If possible, I'd try to minimize this by extending SocialApp class instead. This would make initializing Koin a bit more complicated though I think it pays off. IMHO it is really important to have the execution stack as close to the production as we can.
1b6715b to
762aa21
Compare
|
@victorolinasc please review :) |
|
Nice! It reuses the application now. I will rest much more easily now hehehe Way to go! |
Adds a basic infrastructure to allow us to mock (if needed) or replace dependencies for tests. This will be useful when implementing real features for our app.