Allan Wang
07/13/2020, 7:11 PMcheckModules
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 testedvoben
07/13/2020, 7:15 PMAllan Wang
07/13/2020, 7:20 PMval 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 testedAllan Wang
07/13/2020, 7:23 PMmodules(commonModules + productionModules)
, and I do the same with the test (checkModules { modules(commonModules + productionModules }
)