test

fun <STATE : Any, SIDE_EFFECT : Any, T : ContainerHost<STATE, SIDE_EFFECT>> T.test(initialState: STATE, isolateFlow: Boolean = true, runOnCreate: Boolean = false, blocking: Boolean = true): T

Switches your ContainerHost into test mode. Allows you to isolate the flow to the next one called (default) i.e. method calls on the container beyond the first will be registered but not actually execute. This allows you to assert any loopbacks while keeping your test isolated to the flow you are testing, thus avoiding overly complex tests with many states/side effects being emitted.

Return

Your ContainerHost in test mode.

Parameters

initialState

The state to initialize the test container with

isolateFlow

Whether the flow should be isolated

runOnCreate

Whether to run the container's create lambda

fun <T> Flow<T>.test(): TestFlowObserver<T>

Allows you to put a Flow into test mode.