package eu.friedcutlet.yokan.ui.navigation import eu.friedcutlet.yokan.data.DefaultYokanRepository import eu.friedcutlet.yokan.data.SettingsStore import eu.friedcutlet.yokan.data.YokanRepository import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.plus import kotlinx.coroutines.test.TestScope import kotlinx.coroutines.test.UnconfinedTestDispatcher /** A [Navigator] on the test's unconfined background scope: settings changes and the hidden-section fallback apply synchronously; cancelled when the test ends. */ @OptIn(ExperimentalCoroutinesApi::class) fun TestScope.testNavigator(repository: YokanRepository = DefaultYokanRepository()): Navigator { val scope = backgroundScope + UnconfinedTestDispatcher(testScheduler) return Navigator(SettingsStore(repository, scope) {}, scope) }