Hey folks, I’m getting started with koin and ktor ...
# koin
v
Hey folks, I’m getting started with koin and ktor and have some difficulties with the initial setup as I practically can’t make it working with tests to inject different implementation there.
Copy code
fun 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
Copy code
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 installed
Copy code
Please 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.