-
-
Notifications
You must be signed in to change notification settings - Fork 734
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
Koin test - moduleCheck for parametered injections #274
Comments
weird, parameters should be ignored :/ Your test is failing or is it an error log? |
No, test doesn't fail, but checkModule isn't asserting anything it only logs errors to console. override fun err(msg: String) {
Assert.fail(msg)
} This goes into logs:
Where this module is defined this way: const val temperatureCardScopeName = "temperatureCardScopeName"
val temperatureCardModule = module(temperatureCardScopeName) {
factory { (customView: TemperatureCard) -> TemperatureCardPresenter(customView.presentedView, get()) }
factory { (view: View) -> TemperatureCardView(view) }
} |
Sandbox behind checkModules is still working. It's just a log level problem. |
@arnaudgiuliani @Test
fun paramModuleTest() {
checkModules(listOf(
module {
factory { (usefulParam: UsefulParam) -> A(usefulParam) }
factory { B(get()) }
}))
}
class UsefulParam
class A(usefulParam: UsefulParam)
class B(a: A) |
CheckModules is just here to test links between definitions. This is not the same use. |
Is your feature request related to a problem? Please describe.
I was trying to mock MVP, where View and Presenter are both injected from activity:
Where Di module looks like that:
But moduleCheck always fail with:
Of course code works in activity.
Describe the solution you'd like
I don't know what would be the best solution here. Maybe some way of injecting things from parameters, like below?
Describe alternatives you've considered
I've tried to mock those input parameters, hoping Koin would inject those instead of parameters.
Target Koin project
koin-test
The text was updated successfully, but these errors were encountered: