feat(connector): add VDMJ into Test

This commit is contained in:
Anthony Berg
2024-05-09 09:01:23 +01:00
parent d1b45a4d5a
commit 02d5ed8c35
2 changed files with 10 additions and 2 deletions

View File

@@ -38,7 +38,7 @@ class TestRun (
if (!running and (tested.size == 0)) { if (!running and (tested.size == 0)) {
running = true running = true
screenModel.init() screenModel.init(actions)
} }
when (val s = state) { when (val s = state) {

View File

@@ -5,7 +5,9 @@ import cafe.adriel.voyager.core.model.StateScreenModel
import cafe.adriel.voyager.core.model.screenModelScope import cafe.adriel.voyager.core.model.screenModelScope
import io.anthonyberg.connector.shared.TestTransaction import io.anthonyberg.connector.shared.TestTransaction
import io.anthonyberg.connector.shared.entity.Action import io.anthonyberg.connector.shared.entity.Action
import io.anthonyberg.connector.shared.vdmj.VDMJTransaction
import io.anthonyberg.connector.shared.xpc.XPC import io.anthonyberg.connector.shared.xpc.XPC
import io.github.oshai.kotlinlogging.KotlinLogging
import kotlinx.coroutines.delay import kotlinx.coroutines.delay
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@@ -14,11 +16,12 @@ class TestScreenModel (
private val interfaceState: InterfaceState private val interfaceState: InterfaceState
) : StateScreenModel<TestState>(TestState.Init) { ) : StateScreenModel<TestState>(TestState.Init) {
private val xpc = XPC() private val xpc = XPC()
private val logger = KotlinLogging.logger {}
/** /**
* Sets up necessary connections * Sets up necessary connections
*/ */
fun init() { fun init(actions: List<Action>) {
screenModelScope.launch { screenModelScope.launch {
mutableState.value = TestState.Init mutableState.value = TestState.Init
@@ -47,6 +50,11 @@ class TestScreenModel (
xpc.setPOSI(posi) xpc.setPOSI(posi)
} }
val vdm = VDMJTransaction(actions = actions, xpc = xpc)
val expected = vdm.expectedEndState()
logger.debug { expected }
delay(5000L) delay(5000L)
// Starts the test in the database // Starts the test in the database