Created
September 4, 2020 00:22
-
-
Save cdmunoz/64c0669d6572eb2dafbe1caa0a23f0de to your computer and use it in GitHub Desktop.
Koin's test network module
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun testNetworkModule(baseUrl: String) = module { | |
single { provideTestRetrofit(baseUrl) } | |
single { provideTestApiService(get(), ApiService::class.java) } | |
} | |
fun provideTestRetrofit(baseUrl: String): Retrofit = | |
Retrofit.Builder().baseUrl(baseUrl) | |
.addConverterFactory(GsonConverterFactory.create()).build() | |
fun provideTestApiService(retrofit: Retrofit, apiService: Class<ApiService>) = | |
createService(retrofit, apiService) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment