trying to use koin with kotest in a multiplatform ...
# koin
d
trying to use koin with kotest in a multiplatform project. question one: I wrote a convenience class for reducing boilerplate test code on BehaviorSpec like below, (getting rid of the init { ... } nesting level primarily. ... and now I ask myself if this was a dumb or genius idea: any comments?
Copy code
abstract class KoinBddSpec(val koinModules: List<Module>, behaviorSpec: KoinBddSpec.() -> Unit): KoinTest, BehaviorSpec(behaviorSpec as BehaviorSpec.() -> Unit) { // <-- Unchecked cast
    constructor(vararg koinModules: Module, behaviorSpec: KoinBddSpec.() -> Unit) : this(koinModules.asList(), behaviorSpec)
    override fun extensions() = koinModules.map { KoinExtension(module = it, mode = KoinLifecycleMode.Root) }
}
// usage like:
class MainTest : KoinBddSpec(appModule, behaviorSpec = {
    Given("an injected Dummy") {
        val dummy: Dummy by inject() // <-- injection from koin appModule
        When("calling f() on injected Dummy") {
            val result = dummy.f()
            Then("result should be 1") {
                result shouldEndWith "with DummyDep(dp='depDummy', depDummy(1))"
            }
        }
question two: for mpp native target gradle cannot resolve :
Copy code
Could not resolve io.kotest.extensions:kotest-extensions-koin:1.1.0.
     Required by:
         project :backend
      > No matching variant of io.kotest.extensions:kotest-extensions-koin:1.1.0 was found. The consumer was configured to find a usage of 'kotlin-api' of a library, preferably optimized for non-jvm, as well as attribute 'org.jetbrains.kotlin.platform.type' with value 'native', attribute 'org.jetbrains.kotlin.native.target' with value 'macos_x64' but: ...
why there is no (1.1.0) mpp version for native 'io.kotest.extensionskotest extensions koin1.1.0' ?? (on macos_x64) ``````