OrbitTestContext

class OrbitTestContext<STATE : Any, SIDE_EFFECT : Any, CONTAINER_HOST : ContainerHost<STATE, SIDE_EFFECT>>(val containerHost: CONTAINER_HOST, resolvedInitialState: STATE, emissions: ReceiveTurbine<Item<STATE, SIDE_EFFECT>>, settings: TestSettings)(source)

Constructors

Link copied to clipboard
constructor(containerHost: CONTAINER_HOST, resolvedInitialState: STATE, emissions: ReceiveTurbine<Item<STATE, SIDE_EFFECT>>, settings: TestSettings)

Properties

Link copied to clipboard

Functions

Link copied to clipboard
suspend fun awaitItem(): Item<STATE, SIDE_EFFECT>

Return the next item received. This function will suspend if no items have been received.

Link copied to clipboard

Return the next side effect received. This function will suspend if no side effects have been received.

Link copied to clipboard
suspend fun awaitState(): STATE

Return the next state received. This function will suspend if no states have been received.

Link copied to clipboard

Finish this test and ignore any events which have already been received. This also cancels any in-progress intents.

Link copied to clipboard
suspend fun expectInitialState()

Sanity check assertion. Checks if the initial state is emitted and matches the initial state defined for the production container (or the one specified in the test).

Link copied to clipboard
suspend fun expectNoItems()

Assert there are no unconsumed items

Link copied to clipboard
suspend fun expectSideEffect(expected: SIDE_EFFECT)

Awaits for a side effect and checks if it matches the expected side effect

Link copied to clipboard
suspend fun expectState(expected: STATE)

Awaits for a state and checks if it matches the expected state.

suspend fun expectState(expectedChange: STATE.() -> STATE)

Awaits for a state and checks if it matches the expected state change from the previous state.

Link copied to clipboard
inline suspend fun <LAST_STATE : STATE> expectStateOn(expectedChange: LAST_STATE.() -> STATE)

Awaits for a state and checks if it matches the expected state change from the previous state, ensuring the last state is of the expected type.

Link copied to clipboard
fun runOnCreate(): Job

Invoke onCreate lambda for the ContainerHost.

Link copied to clipboard
suspend fun skipItems(count: Int)

Assert that count items were received and ignore them. This function will suspend if no items have been received.