I am testing a module where the top level has para...
# koin
w
I am testing a module where the top level has parameters. I use checkModules with parameters, but the test only seems to pass some times, most times i get an error that it "Can't get parameter value #0". The following is a sample with the same issue. Anyone who can tell if I'm using it wrong?
Copy code
import org.junit.experimental.categories.Category
import org.junit.jupiter.api.Test
import org.koin.core.parameter.parametersOf
import org.koin.dsl.module
import org.koin.test.AutoCloseKoinTest
import org.koin.test.category.CheckModuleTest
import org.koin.test.check.checkModules

interface First
class FirstImpl(a: String) : First

interface Second
class SecondImpl(a: First) : Second

@Category(CheckModuleTest::class)
internal class KoinTest : AutoCloseKoinTest() {

    @Test
    fun checkModules() {
        val testModule = module {
            single<Second> { SecondImpl(get()) }
            single<First> { (foo: String) -> FirstImpl(foo) }
        }

        checkModules(parameters = { create<First> { parametersOf("hello") } }) {
            modules(testModule)
        }
    }
}
I'm running version 2.1.6