Does `checkModules` test viewModel modules? I’m ha...
# koin
a
Does
checkModules
test viewModel modules? I’m having an issue with resolving a class that has a provider, and after commenting things out I realize none of the viewModel providers seem to be tested
v
I think it checks all modules that are registered in the startKoin block. What does your test look like?
a
This is an example:
Copy code
val commonModules: List<Module> by lazy {
    listOf(a, b)
}

val productionModules: List<Module> by lazy {
    listOf(c)
}

val a = module {
    single<A> { A() }
    viewModel { /* uses A */ }
}

val b = module {
    viewModel { /* uses A */ }
}

val c = module {
    single<C> { C(a = get()) }
}
I don’t think having two lists matter and I haven’t tested ordering yet, but I added it to match my setup. Module c is new, and adding it fails despite the definition being provided from another module. If I add provider A in module c then things work. If I remove all A providers, the test still passes, so the viewModel providers don’t seem to be tested
In the application, I add
modules(commonModules + productionModules)
, and I do the same with the test (
checkModules { modules(commonModules + productionModules }
)