TestDispatchScope

A DispatchScope for testing purposes that registers dispatched actions.

Functions

Link copied to clipboard
abstract fun clearActionsHistory()

Clears history and unverified.

Link copied to clipboard
abstract fun dispatch(action: Action)
Link copied to clipboard
abstract fun onDispatch(block: MutableDispatchScope<State>.(Action) -> Unit)

Sets a block that will be called on every dispatch called by component under test. Each call replaces previously provided block.

Properties

Link copied to clipboard
abstract var closure: DispatchClosure
Link copied to clipboard
abstract var currentState: State
Link copied to clipboard
abstract val history: List<Action>

Contains all dispatched actions history.

Link copied to clipboard
abstract val unverified: Queue<Action>

Contains all unverified dispatched actions queue. If action is verified, it must be pulled from this queue.

Extensions

Link copied to clipboard

Returns a string that contains list of all dispatched actions. The action recently pulled form the queue is marked with '->'.

Link copied to clipboard

Asserts that first unverified action is equal to action.

Link copied to clipboard
inline fun <T : Action> ActionsAssertScope.assertActionOfType(assertions: (T) -> Unit = {})

Asserts that first unverified action is an instance of type T. Also, it applies additional assertions.

Link copied to clipboard

Asserts that there are only actions dispatched in given order and no more.

Link copied to clipboard

Asserts that all dispatched actions count is equal to count. It does not pull any action from unverified queue.

Link copied to clipboard
fun ActionsAssertScope.assertEveryAction(message: String? = null, predicate: (Action) -> Boolean)

Asserts that every unverified action matches the predicate.

Link copied to clipboard

Asserts that there is no dispatched actions.

Link copied to clipboard

Asserts that there is no unverified actions left.

Link copied to clipboard

Asserts that first unverified action is equal to action and it is the only one dispatched action.

Link copied to clipboard
inline fun <T : Action> ActionsAssertScope.assertSingleActionOfType(assertions: (T) -> Unit = {})

Asserts that first unverified action is an instance of T and it is the only one dispatched action. Also, it applies additional assertions.

Link copied to clipboard

Returns first unverified action.

Link copied to clipboard

Prints information about dispatched actions based on actionStackString.

Link copied to clipboard

Skips first n unverified actions.

Link copied to clipboard

Skips actions while predicate is true.

Link copied to clipboard

Skips first unverified action.

Link copied to clipboard

Skips all unverified actions.