object MockableMavericks
Entry point for setting up Mavericks for the app in a mockable way.
See initialize
var enableMavericksViewMocking: Boolean
Calls to MockableMavericksView.provideMocks will return empty unless this is enabled. |
|
var enableMockPrinterBroadcastReceiver: Boolean
Calls to MavericksMockPrinter.startReceiver will be no-ops unless this is enabled. |
|
val mockConfigFactory: MockMavericksViewModelConfigFactory |
|
var mockPrinterConfiguration: MockPrinterConfiguration
Configuration for how mock state is printed. |
|
val mockStateHolder: MockStateHolder
This global instance enables mock states to be forced onto ViewModels as they are created. This enable easy testing. |
fun initialize(applicationContext: Context): Unitfun initialize(mocksEnabled: Boolean, debugMode: Boolean, applicationContext: Context?, viewModelCoroutineContext: CoroutineContext = EmptyCoroutineContext, stateStoreCoroutineContext: CoroutineContext = EmptyCoroutineContext, subscriptionCoroutineContextOverride: CoroutineContext = EmptyCoroutineContext): Unit
Initializes the required Mavericks.viewModelConfigFactory and sets ViewModel debug and mock behavior for the app. |
|
fun <VM : MavericksViewModel<S>, S : MavericksState> setScriptableState(viewModel: VM, state: S): Unit
If the given viewmodel has a state store that implements ScriptableStateStore then this function can be used to set the next state via ScriptableStateStore.next. |
|
fun <VM : MavericksViewModel<S>, S : MavericksState> setState(viewModel: VM, state: S): Unit
A helper to set a state on a view model via MavericksStateStore.set. |