Ofek Teken
10/08/2024, 1:16 PMKtor
and I'm trying to inject into a Test
a class that is scoped to a Ktor`Request`.
If I switch the Scope
annotations with Factory
, Everything is working perfectly and Koin figures out the dependency graph.
I'm not using Ktor's testApplication
because while these classes are indeed scoped to a Ktor Request, they aren't really related to Ktor and I just generally need to test their logic. ("They just happen to be scoped")
Is it possible to do so?Ofek Teken
10/08/2024, 1:17 PMclass SomeClass {
operator fun invoke(someInt: Int) {
}
}
class Test : KoinTest {
private val someClass: SomeClass by inject()
@JvmField
@RegisterExtension
val koinTestExtension = KoinTestExtension.create {
modules(defaultModule)
}
@Test
fun a() = runBlocking {
someClass(1)
assertTrue(true)
}
}
arnaud.giuliani
10/16/2024, 7:14 AM