commonMain.com.copperleaf.ballast.test.internal.vm.TestSideJobScope.kt Maven / Gradle / Ivy
package com.copperleaf.ballast.test.internal.vm
import com.copperleaf.ballast.BallastLogger
import com.copperleaf.ballast.SideJobScope
import kotlinx.coroutines.CompletableDeferred
import kotlinx.coroutines.CoroutineScope
internal class TestSideJobScope(
private val sideJobScopeDelegate: SideJobScope, Events, State>,
) : SideJobScope, CoroutineScope by sideJobScopeDelegate {
override val logger: BallastLogger get() = sideJobScopeDelegate.logger
override val currentStateWhenStarted: State get() = sideJobScopeDelegate.currentStateWhenStarted
override val restartState: SideJobScope.RestartState get() = sideJobScopeDelegate.restartState
override suspend fun postInput(input: Inputs) {
val deferred = CompletableDeferred()
sideJobScopeDelegate.postInput(
TestViewModel.Inputs.ProcessInput(input, deferred)
)
deferred.await()
}
override suspend fun postEvent(event: Events) {
sideJobScopeDelegate.postEvent(event)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy