commonMain.com.copperleaf.ballast.test.internal.vm.TestSideEffectScope.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ballast-test-jvm Show documentation
Show all versions of ballast-test-jvm Show documentation
Opinionated Application State Management framework for Kotlin Multiplatform
package com.copperleaf.ballast.test.internal.vm
import com.copperleaf.ballast.SideEffectScope
import kotlinx.coroutines.CompletableDeferred
internal class TestSideEffectScope(
private val sideEffectScopeDelegate: SideEffectScope, Events, State>,
) : SideEffectScope {
override val currentStateWhenStarted: State get() = sideEffectScopeDelegate.currentStateWhenStarted
override val restartState: SideEffectScope.RestartState get() = sideEffectScopeDelegate.restartState
override suspend fun postInput(input: Inputs) {
val deferred = CompletableDeferred()
sideEffectScopeDelegate.postInput(
TestViewModel.Inputs.ProcessInput(input, deferred)
)
deferred.await()
}
override suspend fun postEvent(event: Events) {
sideEffectScopeDelegate.postEvent(event)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy