TestHostNavigator

class TestHostNavigator(var handleDeepLinkRoute: NavRoute? = null) : HostNavigator

Constructors

Link copied to clipboard
constructor(handleDeepLinkRoute: NavRoute? = null)

Properties

Link copied to clipboard
var handleDeepLinkRoute: NavRoute?
Link copied to clipboard
Link copied to clipboard
open override val snapshot: State<StackSnapshot>

Functions

Link copied to clipboard
open override fun backPresses(): Flow<Unit>
open override fun <T> backPresses(value: T): Flow<T>
Link copied to clipboard
open override fun <O : Parcelable> deliverNavigationResult(key: NavigationResultRequest.Key<O>, result: O)
Link copied to clipboard

Causes an emission to the current TestHostNavigator.backPresses collector to make it possible to simulate a back press in tests that check custom back press logic.

Link copied to clipboard
open override fun handleDeepLink(intent: Intent, deepLinkHandlers: ImmutableSet<DeepLinkHandler>, deepLinkPrefixes: ImmutableSet<DeepLinkHandler.Prefix>): Boolean

The fake implementation will call navigateTo with handleDeepLinkRoute if the latter is not null. Otherwise it will just return false.

Link copied to clipboard
open override fun navigate(block: Navigator.() -> Unit)
Link copied to clipboard
open override fun navigateBack()
Link copied to clipboard
open override fun <T : BaseRoute> navigateBackTo(popUpTo: KClass<T>, inclusive: Boolean)
Link copied to clipboard
open override fun navigateTo(route: NavRoute)
Link copied to clipboard
open override fun navigateUp()
Link copied to clipboard
open override fun <T : BaseRoute, O : Parcelable> registerForNavigationResultInternal(id: DestinationId<T>, resultType: String): NavigationResultRequest<O>
Link copied to clipboard
open override fun replaceAllBackStacks(root: NavRoot)
Link copied to clipboard
open override fun showRoot(root: NavRoot)
Link copied to clipboard
open override fun switchBackStack(root: NavRoot)
Link copied to clipboard
suspend fun TestHostNavigator.test(timeout: Duration? = null, name: String? = null, validate: suspend NavigatorTurbine.() -> Unit)

Collects events from TestHostNavigator and allows the validate lambda to consume and assert properties on them in order. If any exception occurs during validation the exception is rethrown from this method.

Link copied to clipboard
fun TestHostNavigator.testIn(scope: CoroutineScope, timeout: Duration? = null, name: String? = null): NavigatorTurbine

Collects events from TestHostNavigator and returns a NavigatorTurbine for consuming and asserting properties on them in order. If any exception occurs during validation the exception is rethrown from this method.