StoreTestScope

A class which implements a dsl for testing Store.

Properties

Link copied to clipboard
open override val actions: Flow<A>
Link copied to clipboard
open override val isActive: Boolean
Link copied to clipboard
open override val isStarted: Boolean
Link copied to clipboard
open override val name: String?
Link copied to clipboard
Link copied to clipboard
open override val states: StateFlow<S>
Link copied to clipboard
val store: Store<S, I, A>
Link copied to clipboard
val timeoutMs: Long = 3000

Functions

Link copied to clipboard
open suspend override fun awaitStartup()
Link copied to clipboard
open suspend override fun awaitUntilClosed()
Link copied to clipboard
expect open override fun close()
Link copied to clipboard
open suspend override fun closeAndWait()
Link copied to clipboard
open suspend override fun emit(intent: I)
Link copied to clipboard
Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun intent(intent: I)
Link copied to clipboard
inline suspend fun <S> I.resultsIn()

Assert that Provider.state's state is of type S

infix inline suspend fun I.resultsIn(action: A)

Assert that intent this results in action

infix inline suspend fun I.resultsIn(state: S)

Assert that Provider.state is equal to state

infix inline suspend fun I.resultsIn(assertion: () -> Unit)

Assert that intent this passes checks defined in assertion

Link copied to clipboard
open override fun start(scope: CoroutineScope): StoreLifecycle
Link copied to clipboard
open override fun CoroutineScope.subscribe(block: suspend Provider<S, I, A>.() -> Unit): Job
Link copied to clipboard
inline suspend fun <S : MVIState, I : MVIIntent, A : MVIAction> Store<S, I, A>.subscribeAndTest(crossinline block: suspend StoreTestScope<S, I, A>.() -> Unit)

Call Store.start, then call Store.subscribe and execute block inside that scope. Unsubscribe and stop the store afterwards

Link copied to clipboard
inline suspend fun <S : MVIState, I : MVIIntent, A : MVIAction> Store<S, I, A>.test(crossinline block: suspend Store<S, I, A>.() -> Unit)

Call Store.start and then execute block, cancelling the store afterwards