TestEventSink

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

Note: this class was heavily influenced by RxJava3's https://github.com/ReactiveX/RxJava/blob/v3.1.6/src/main/java/io/reactivex/rxjava3/observers/BaseTestConsumer.java.

See also

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

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

Assert that this TestEventSink as received exactly one UiEvent and that it equals event.

Assert that this TestEventSink has received exactly one UiEvent and that running predicate with that event returns true.

Link copied to clipboard

Assert that this TestEventSink received an event at index which is equal to the given event.

fun assertEventAt(index: Int, predicate: (UiEvent) -> Boolean): TestEventSink<UiEvent>

Assert this TestEventSink received an event at index and that running predicate with that event returns true.

Link copied to clipboard

Assert that this TestEventSink has received count events.

Link copied to clipboard

Assert that this TestEventSink received only the specified events in the specified order.

Assert that predicate returns true for each event received by this TestEventSink.

Link copied to clipboard

Assert that this TestEventSink has not received any events.

Link copied to clipboard
open operator override fun invoke(event: UiEvent)

Sends the specified event to this TestEventSink.