Dirk Hoffmann
04/20/2023, 12:31 PMabstract 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 :
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)
``````