Mohsen
10/25/2023, 9:21 PMNo definition found for type 'com.client.githubusers.data.repository.UsersRepositoryImpl'.
Impl:
class UsersRepositoryTest : KoinTest {
private val usersRepository: UsersRepository by inject<UsersRepositoryImpl>()
@OptIn(ExperimentalCoroutinesApi::class)
private val testScope = TestScope(UnconfinedTestDispatcher())
private val usersStub = StubUtil.getDummyUsers()
private val userDetailStub = StubUtil.getDummyUserDetail()
@Before
fun setup() {
startKoin {
modules(
module {
single<UsersRepository> { UsersRepositoryImpl(get()) }
})
}
}
What am I doing wrong here?mkrussel
10/25/2023, 9:32 PMUserRepository
, but the inject is looking for UserRepositoryImpl
.Mohsen
10/25/2023, 9:37 PMmkrussel
10/25/2023, 9:38 PMMohsen
10/25/2023, 9:40 PMprivate val usersRepository: UsersRepositoryImpl by inject()
And:
single { UsersRepositoryImpl(get()) }
Maybe I am missing something?mkrussel
10/25/2023, 9:41 PMget
in the constructor call supposed to return and is that available?
I doesn't seem like it would be since there is only one module and one item in the module, but my koin knowledge is very limited.Mohsen
10/25/2023, 9:43 PMmkrussel
10/25/2023, 9:44 PMMohsen
10/25/2023, 9:46 PMprivate val usersRepository: UsersRepositoryImpl by inject()
private val usersApi: UsersApi by inject()
module {
single { UsersRepositoryImpl(usersApi) }
})
Mohsen
10/25/2023, 9:46 PMmkrussel
10/25/2023, 9:47 PMmkrussel
10/25/2023, 9:48 PMsingle
to your module. And either create a fake instance of the api or add more code that initializes retrofit to be able to create the real version of the api.