Yokan / rebuild
Course 1 8624561

TestNavigator.kt

composeApp/src/commonTest/kotlin/eu/friedcutlet/yokan/ui/navigation/TestNavigator.kt

test / fixture16 lines
1package eu.friedcutlet.yokan.ui.navigation23import eu.friedcutlet.yokan.data.DefaultYokanRepository4import eu.friedcutlet.yokan.data.SettingsStore5import eu.friedcutlet.yokan.data.YokanRepository6import kotlinx.coroutines.ExperimentalCoroutinesApi7import kotlinx.coroutines.plus8import kotlinx.coroutines.test.TestScope9import kotlinx.coroutines.test.UnconfinedTestDispatcher1011/** A [Navigator] on the test's unconfined background scope: settings changes and the hidden-section fallback apply synchronously; cancelled when the test ends. */12@OptIn(ExperimentalCoroutinesApi::class)13fun TestScope.testNavigator(repository: YokanRepository = DefaultYokanRepository()): Navigator {14    val scope = backgroundScope + UnconfinedTestDispatcher(testScheduler)15    return Navigator(SettingsStore(repository, scope) {}, scope)16}17

Search chapters, reference and source filenames.