TransmissionTestScope

Sends messages to the transformer under test, fakes what it depends on, and awaits its output.

Functions

Link copied to clipboard
inline suspend fun <reified T : Transmission.Data> awaitData(): T

The next data of type T, skipping data of other types. Fails, listing what arrived, if none does.

suspend fun <T : Transmission.Data> awaitData(type: KClass<T>): T

The next data of type, skipping data of other types.

Link copied to clipboard
inline suspend fun <reified T : Transmission.Effect> awaitEffect(): T

The next effect of type T, skipping effects of other types. Fails, listing what arrived, if none does.

suspend fun <T : Transmission.Effect> awaitEffect(type: KClass<T>): T

The next effect of type, skipping effects of other types.

Link copied to clipboard
suspend fun <T : Transmission.Data?> awaitState(handle: StateHandle<T>): T

The current value of handle once everything sent so far has been handled.

Link copied to clipboard

Fails if any effect not yet awaited was published.

Link copied to clipboard
fun fake(command: Command): FakeCommand

Accepts command and counts its calls.

Accepts command and records its arguments.

fun <A : Any, R> fake(query: QueryWithArgs<A, R>, answer: (A) -> R)

Answers query with answer for each argument.

fun <R> fake(query: Query<R>, answer: () -> R)

Answers query with answer, in place of the transformer that serves it.

fun <T : Transmission.Data?> fake(state: StateHandle<T>, value: T)

Publishes value as state, as another transformer would.

Link copied to clipboard

Sends a signal or an effect to the router, in order with earlier sends.

Link copied to clipboard
fun settle()

Runs every pending message to completion. Handlers waiting in awaitSignal count as settled.