Hi! Today we solved a problem with espresso tests ...
# koin
s
Hi! Today we solved a problem with espresso tests but I don't understand why. Let me explain the situation before solving it, we had an appModule that was providing the context like this:
Copy code
val appModule = module {	
  single { get<Context>() as InitApp }	
}
And then a dependency that requires the context was satisfied like this:
Copy code
single { DependencyContext(get<Context>()) }
single { AnotherDependencyContext(get()) } // get() refers to Context
I don't know if it's important but in some places context was satisfied with casting and in another places without casting. The problem was that Espresso tests were failing because
AnotherDependencyContext
could not be satisfied. The solution is change every
get<Context>()
and
get()
(referring to Context) by
androidContext()
and stop providing Context through
appModule
. Do you know why?