Package app.cash.turbine

Types

Event
Link copied to clipboard
sealed class Event<out T>
FlowTurbine
Link copied to clipboard
interface FlowTurbine<T>

Represents active collection on a source Flow which buffers item emissions, completion, and/or errors as events for consuming.

Functions

test
Link copied to clipboard
suspend fun <T> Flow<T>.test(timeoutMs: Long = 1_000L, validate: suspend FlowTurbine<T>.() -> Unit)
suspend fun <T> Flow<T>.test(timeout: Duration, validate: suspend FlowTurbine<T>.() -> Unit)

Terminal flow operator that collects events from given flow 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.

Properties

timeout
Link copied to clipboard
val FlowTurbine<*>.timeout: Duration

Duration that awaitItem, awaitComplete, awaitError, and awaitEvent will wait before throwing a timeout exception.