Package-level declarations

Types

Link copied to clipboard

Base expect type for TestEventSink. This layer of indirection is necessary because Kotlin/JS does not allow extension of function types. To work around it, we make this interface extend (UiEvent) -> Unit on all platforms except JS, and then expose an asEventSinkFunction() extension function on TestEventSink in JS that returns a function wrapper around it.

expect sealed interface BaseTestEventSinkType<UiEvent>

Base expect type for TestEventSink. This layer of indirection is necessary because Kotlin/JS does not allow extension of function types. To work around it, we make this interface extend (UiEvent) -> Unit on all platforms except JS, and then expose an asEventSinkFunction() extension function on TestEventSink in JS that returns a function wrapper around it.

Base expect type for TestEventSink. This layer of indirection is necessary because Kotlin/JS does not allow extension of function types. To work around it, we make this interface extend (UiEvent) -> Unit on all platforms except JS, and then expose an asEventSinkFunction() extension function on TestEventSink in JS that returns a function wrapper around it.

Base expect type for TestEventSink. This layer of indirection is necessary because Kotlin/JS does not allow extension of function types. To work around it, we make this interface extend (UiEvent) -> Unit on all platforms except JS, and then expose an asEventSinkFunction() extension function on TestEventSink in JS that returns a function wrapper around it.

actual interface BaseTestEventSinkType<UiEvent>

Base expect type for TestEventSink. This layer of indirection is necessary because Kotlin/JS does not allow extension of function types. To work around it, we make this interface extend (UiEvent) -> Unit on all platforms except JS, and then expose an asEventSinkFunction() extension function on TestEventSink in JS that returns a function wrapper around it.

Link copied to clipboard

A Circuit-specific extension to ReceiveTurbine with extra helper functions for Circuit testing.

Link copied to clipboard
@Target(allowedTargets = [AnnotationTarget.CLASS])
@RequiresOptIn(level = RequiresOptIn.Level.WARNING, message = "Inheriting from this circuit-test API is unstable. Either new methods may be added in the future, which would break the inheritance, or correctly inheriting from it requires fulfilling contracts that may change in the future.")
annotation class ExperimentalForInheritanceCircuitTestApi
Link copied to clipboard

A fake Navigator that can be used in tests to record and assert navigation events.

Link copied to clipboard

A test event sink that records events from a Circuit UI and allows making assertions about them.

Functions

Link copied to clipboard

A helper function for creating a function wrapper around this TestEventSink for use in tests as an event sink function. We have to do this workaround in JS due to Kotlin/JS not allowing function type extension directly.

Link copied to clipboard
suspend fun <UiState : CircuitUiState> presenterTestOf(presentFunction: @Composable () -> UiState, timeout: Duration? = null, name: String? = null, policy: SnapshotMutationPolicy<UiState> = structuralEqualityPolicy(), block: suspend CircuitReceiveTurbine<UiState>.() -> Unit)

Presents this presentFunction and invokes a suspend CircuitReceiveTurbine that can be used to assert state emissions from it.

Link copied to clipboard
suspend fun <UiState : CircuitUiState> Presenter<UiState>.test(timeout: Duration? = null, name: String? = null, policy: SnapshotMutationPolicy<UiState> = structuralEqualityPolicy(), block: suspend CircuitReceiveTurbine<UiState>.() -> Unit)

Presents this Presenter and invokes a suspend ReceiveTurbine that can be used to assert state emissions from this presenter.

suspend fun <UiState : CircuitUiState> Presenter<UiState>.test(vararg locals: ProvidedValue<*>, timeout: Duration? = null, name: String? = null, policy: SnapshotMutationPolicy<UiState> = structuralEqualityPolicy(), block: suspend CircuitReceiveTurbine<UiState>.() -> Unit)

Helper function to test a Presenter in a way that allows for providing dependencies via CompositionLocalProvider