class MockableMavericksStateStore<S : MavericksState> : MockableStateStore<S>
Allows switching between a mocked state store and a real state store behavior. This is intended to enable testing.
When StateStoreBehavior.Scriptable behavior is set, next can be called to force a state synchronously. When in this mode, calls to set have no effect. In other modes, it is an error to call next.
The mode can be dynamically changed to modify behavior at runtime.
MockableMavericksStateStore(initialState: S, mockBehavior: MockBehavior, coroutineScope: CoroutineScope, contextOverride: CoroutineContext = EmptyCoroutineContext)
Allows switching between a mocked state store and a real state store behavior. This is intended to enable testing. |
val coroutineScope: CoroutineScope |
|
val flow: Flow<S> |
|
var mockBehavior: MockBehavior |
|
val state: S |
fun addOnCancelListener(callback: (MockableMavericksStateStore<*>) -> Unit): Unit |
|
fun addOnStateSetListener(callback: (previousState: S, newState: S) -> Unit): Unit
Add a listener that will be called each time a state is set on this state store via the set function. |
|
fun get(block: (S) -> Unit): Unit |
|
fun next(state: S): Unit |
|
fun removeOnStateSetListener(callback: (previousState: S, newState: S) -> Unit): Unit |
|
fun set(stateReducer: S.() -> S): Unit |