Hey all, I'm a bit lost on testing my koin module....
# koin
p
Hey all, I'm a bit lost on testing my koin module. Let's assume I have something like this:
Copy code
internal val someModule = module {
   scope<TheOwnerOfThings>{
      scope<Scope1> { 
         scoped <SomeInterface>{ (param: String) -> ThisThing(param) }
      }
      scope<Scope2> {
         scoped <SomeInterface>{ (param: String) -> ThatThing(param) }
      }
   }
}
How would I go about testing the creation of
ThisThing
and
ThatThing
? Clearly calling the following wouldn't work...
Copy code
create<SomeInterface> { parametersOf("Lol") }
...since koin wouldn't know which
SomeInterface
to create. And calling this would also not work...
Copy code
create<ThatThing> { parametersOf("Lol") }
...since none of my definitions returns a
ThatThing
type. I figure a way to get around this would be to split
Scope1
and
Scope2
into separate modules, but I can't do this because I want to limit the scope of these to be within the scope of
TheOwnerOfThings
. Is there a solution to this?