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 PM
Copy code
class 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)
}
}
a
arnaud.giuliani
10/16/2024, 7:14 AM
problem is that yoru scope is created from a Ktor request. Are you creating it by hand?