Skip to content

Commit

Permalink
fix: Fix failing tests and build
Browse files Browse the repository at this point in the history
  • Loading branch information
0ffz committed Jul 25, 2024
1 parent 3c7ed2a commit b0c4850
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
11 changes: 11 additions & 0 deletions addons/geary-actions/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,16 @@ kotlin {
implementation(idofrontLibs.idofront.di)
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test"))
implementation(idofrontLibs.kotlinx.coroutines.test)
implementation(idofrontLibs.kotest.assertions)
implementation(idofrontLibs.kotest.property)
implementation(idofrontLibs.idofront.di)
implementation(project(":geary-core"))
implementation(project(":geary-serialization"))
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.mineinabyss.geary.actions.actions
import com.mineinabyss.geary.actions.Action
import com.mineinabyss.geary.actions.ActionsCancelledException
import com.mineinabyss.geary.actions.ActionGroupContext
import com.mineinabyss.geary.actions.Condition
import com.mineinabyss.geary.actions.event_binds.EventBind
import com.mineinabyss.geary.helpers.componentId
import com.mineinabyss.geary.serialization.serializers.InnerSerializer
Expand All @@ -16,15 +17,15 @@ class EnsureAction(
val conditions: SerializedComponents,
) : Action {
@Transient
private val flat = conditions.map { EventBind.CachedEvent(componentId(it::class), it) }
private val flat = conditions.map { componentId(it::class) to it }

override fun ActionGroupContext.execute() {
flat.forEach {
when (val condition = it.data) {
is Conwdition -> with(condition) {
flat.forEach { (id, data) ->
when (data) {
is Condition -> with(data) {
if(!execute()) throw ActionsCancelledException()
}
else -> entity.emit(it.componentId, it.data) //TODO use geary condition system if we get one
else -> entity.emit(id, data) //TODO use geary condition system if we get one
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
package com.mineinabyss.geary.prefabs.observers
package com.mineinabyss.geary.actions

import com.mineinabyss.geary.actions.event_binds.EntityObservers
import com.mineinabyss.geary.modules.TestEngineModule
import com.mineinabyss.geary.modules.geary
import com.mineinabyss.geary.prefabs.Prefabs
import com.mineinabyss.geary.prefabs.configuration.components.EntityObservers
import com.mineinabyss.geary.serialization.dsl.serialization
import com.mineinabyss.geary.serialization.dsl.withCommonComponentNames
import com.mineinabyss.geary.serialization.formats.YamlFormat
import com.mineinabyss.geary.serialization.serializableComponents
import com.mineinabyss.geary.serialization.serializers.GearyEntitySerializer
import com.mineinabyss.geary.systems.builders.observeWithData
import com.mineinabyss.idofront.di.DI
import io.kotest.assertions.print.Print
import io.kotest.matchers.shouldBe
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
Expand All @@ -32,7 +30,7 @@ class ConfigEntityObserversTests {
fun createEngine() {
DI.clear()
geary(TestEngineModule) {
install(Prefabs)
install(GearyActions)

serialization {
withCommonComponentNames()
Expand All @@ -53,9 +51,8 @@ class ConfigEntityObserversTests {
// arrange
val entityDef = """
geary:observe:
- event: geary:onSet
involving: [ geary:myComp ]
emit:
geary:onSet:
# TODO involving: [ geary:myComp ]
- geary:print:
string: "Hello World"
""".trimIndent()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ interface Prefabs {
createParseRelationWithDataListener()
createTrackPrefabsByKeyListener()
createCopyToInstancesSystem()
bindEntityObservers()
reEmitEvent()
}
geary.pipeline.runOnOrAfter(GearyPhase.INIT_ENTITIES) {
Expand Down

0 comments on commit b0c4850

Please sign in to comment.