states

fun states(vararg expectedStateChanges: STATE.() -> STATE)

Assert that the expected sequence of state changes has been emitted.

The initial state is asserted automatically, only assert further states.

Every assertion is a lambda with the previous state as the receiver. It is therefore recommended to use copy to make your tests more concise and readable.

We are more interested in how the state changed from the previous one, rather than what it currently is.

testSubject.assert {
states(
{ copy(count = 2) },
{ copy(count = 4) },
{ copy(finished = true) }
)
}

Parameters

expectedStateChanges

A list of expected state changes. Each lambda has the previous state as the receiver.

Sources

(source)
Link copied to clipboard