Vasyl Dizhak
08/07/2022, 8:50 AMfun Application.webModule(koinModules: List<org.koin.core.module.Module> = listOf(applicationModule)) {
install(Koin) {
printLogger(level = <http://Level.INFO|Level.INFO>)
modules(koinModules)
}
val tracksController: TracksControllerInterface by inject()
configureRouting(tracksController)
}
In the tests I create the mock that I inject
private val tracksController = mockk<TracksController>()
private val testModule = module {
single<TracksControllerInterface> { tracksController }
}
@Test
fun `GET tracks returns list of available tracks`() = testApplication {
application {
stopKoin()
webModule(koinModules = listOf(testModule))
}
But I keep getting issue that Koin plugin was already installedVasyl Dizhak
08/07/2022, 8:51 AMPlease make sure that you use unique name for the plugin and don't install it twice. Conflicting application plugin is already installed with the same key as `Koin`
I understand that testApplication
actually does that, but not sure what is the best way to hook into it and make it working. Many thanks for suggestions, links or articles.