File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
src/testDemo/kotlin/com/google/samples/apps/nowinandroid/ui Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -116,15 +116,16 @@ dependencies {
116116 testImplementation(projects.sync.syncTest)
117117 testImplementation(libs.kotlin.test)
118118
119+ testDemoImplementation(libs.androidx.navigation.testing)
119120 testDemoImplementation(libs.robolectric)
120121 testDemoImplementation(libs.roborazzi)
121122 testDemoImplementation(projects.core.screenshotTesting)
123+ testDemoImplementation(projects.core.testing)
122124
123125 androidTestImplementation(projects.core.testing)
124126 androidTestImplementation(projects.core.dataTest)
125127 androidTestImplementation(projects.core.datastoreTest)
126128 androidTestImplementation(libs.androidx.test.espresso.core)
127- androidTestImplementation(libs.androidx.navigation.testing)
128129 androidTestImplementation(libs.androidx.compose.ui.test)
129130 androidTestImplementation(libs.hilt.android.testing)
130131 androidTestImplementation(libs.kotlin.test)
Original file line number Diff line number Diff line change @@ -31,22 +31,27 @@ import com.google.samples.apps.nowinandroid.core.testing.repository.TestNewsRepo
3131import com.google.samples.apps.nowinandroid.core.testing.repository.TestUserDataRepository
3232import com.google.samples.apps.nowinandroid.core.testing.util.TestNetworkMonitor
3333import com.google.samples.apps.nowinandroid.core.testing.util.TestTimeZoneMonitor
34+ import dagger.hilt.android.testing.HiltAndroidTest
35+ import dagger.hilt.android.testing.HiltTestApplication
3436import kotlinx.coroutines.flow.collect
3537import kotlinx.coroutines.launch
3638import kotlinx.coroutines.test.UnconfinedTestDispatcher
3739import kotlinx.coroutines.test.runTest
3840import kotlinx.datetime.TimeZone
3941import org.junit.Rule
4042import org.junit.Test
43+ import org.junit.runner.RunWith
44+ import org.robolectric.RobolectricTestRunner
45+ import org.robolectric.annotation.Config
4146import kotlin.test.assertEquals
4247import kotlin.test.assertTrue
4348
4449/* *
4550 * Tests [NiaAppState].
46- *
47- * Note: This could become an unit test if Robolectric is added to the project and the Context
48- * is faked.
4951 */
52+ @RunWith(RobolectricTestRunner ::class )
53+ @Config(application = HiltTestApplication ::class )
54+ @HiltAndroidTest
5055class NiaAppStateTest {
5156
5257 @get:Rule
You can’t perform that action at this time.
0 commit comments