commonMain.com.copperleaf.ballast.test.internal.ViewModelTestScenarioScopeImpl.kt Maven / Gradle / Ivy
package com.copperleaf.ballast.test.internal
import com.copperleaf.ballast.InputStrategy
import com.copperleaf.ballast.test.TestResults
import com.copperleaf.ballast.test.ViewModelTestScenarioInputSequenceScope
import com.copperleaf.ballast.test.ViewModelTestScenarioScope
import kotlin.time.Duration
import kotlin.time.ExperimentalTime
@ExperimentalTime
internal class ViewModelTestScenarioScopeImpl(
override val name: String
) : ViewModelTestScenarioScope {
internal var givenBlock: (() -> State)? = null
internal lateinit var onInputSequenceBlock:
suspend ViewModelTestScenarioInputSequenceScope.() -> Unit
internal lateinit var verifyBlock: TestResults.() -> Unit
internal var logger: ((String) -> Unit)? = null
internal var timeout: Duration? = null
internal var inputStrategy: InputStrategy? = null
override fun logger(block: (String) -> Unit) {
this.logger = block
}
override fun timeout(timeout: () -> Duration) {
this.timeout = timeout()
}
override fun inputStrategy(inputStrategy: () -> InputStrategy) {
this.inputStrategy = inputStrategy()
}
override fun given(block: () -> State) {
givenBlock = block
}
override fun running(block: suspend ViewModelTestScenarioInputSequenceScope.() -> Unit) {
onInputSequenceBlock = block
}
override fun resultsIn(block: TestResults.() -> Unit) {
verifyBlock = block
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy