Provide Default dispatcher for instrumented tests

Change-Id: I488a9b9d9d3864ce9496614ab35332ec19d06bcc
pull/750/head
Don Turner 2 years ago
parent b245334a18
commit d319264ef0

@ -25,4 +25,5 @@ android {
dependencies { dependencies {
api(project(":core:data")) api(project(":core:data"))
implementation(project(":core:testing")) implementation(project(":core:testing"))
implementation(project(":core:common"))
} }

@ -26,6 +26,7 @@ dependencies {
api(project(":core:datastore")) api(project(":core:datastore"))
api(libs.androidx.dataStore.core) api(libs.androidx.dataStore.core)
implementation(libs.protobuf.kotlin.lite)
implementation(project(":core:common")) implementation(project(":core:common"))
implementation(project(":core:testing")) implementation(project(":core:testing"))
} }

@ -17,6 +17,7 @@
package com.google.samples.apps.nowinandroid.core.testing.di package com.google.samples.apps.nowinandroid.core.testing.di
import com.google.samples.apps.nowinandroid.core.network.Dispatcher import com.google.samples.apps.nowinandroid.core.network.Dispatcher
import com.google.samples.apps.nowinandroid.core.network.NiaDispatchers.Default
import com.google.samples.apps.nowinandroid.core.network.NiaDispatchers.IO import com.google.samples.apps.nowinandroid.core.network.NiaDispatchers.IO
import com.google.samples.apps.nowinandroid.core.network.di.DispatchersModule import com.google.samples.apps.nowinandroid.core.network.di.DispatchersModule
import dagger.Module import dagger.Module
@ -35,4 +36,10 @@ object TestDispatchersModule {
@Provides @Provides
@Dispatcher(IO) @Dispatcher(IO)
fun providesIODispatcher(testDispatcher: TestDispatcher): CoroutineDispatcher = testDispatcher fun providesIODispatcher(testDispatcher: TestDispatcher): CoroutineDispatcher = testDispatcher
@Provides
@Dispatcher(Default)
fun providesDefaultDispatcher(
testDispatcher: TestDispatcher,
): CoroutineDispatcher = testDispatcher
} }

Loading…
Cancel
Save