Files
correx/testing/approvals/src/test/kotlin/ApprovalTriggerTest.kt
T
kami f827685ed0 chore(damn): detekt, build, tests, formatting
fixed detekt issues where possible.
fixed disttar failing build because tools is added twice in the server module.
added workflowId where required.
fixed some tests not being recognized because of runBlocking without explicit return type.
formatting + imports.
2026-05-22 00:10:05 +04:00

51 lines
1.4 KiB
Kotlin

import com.correx.core.validation.approval.ApprovalTrigger
import com.correx.core.validation.model.ValidationIssue
import com.correx.core.validation.model.ValidationReport
import com.correx.core.validation.model.ValidationSection
import com.correx.core.validation.model.ValidationSeverity
import org.junit.jupiter.api.Assertions.assertNotNull
import org.junit.jupiter.api.Assertions.assertNull
import org.junit.jupiter.api.Test
class ApprovalTriggerTest {
private val trigger = ApprovalTrigger()
@Test
fun `should trigger approval on error`() {
val report = ValidationReport(
sections = listOf(
ValidationSection(
name = "graph",
issues = listOf(
ValidationIssue(
code = "GRAPH_DANGLING_TRANSITION",
message = "error",
severity = ValidationSeverity.ERROR,
),
),
),
),
)
val result = trigger.evaluate(report)
assertNotNull(result)
}
@Test
fun `should not trigger approval on clean report`() {
val report = ValidationReport(
sections = listOf(
ValidationSection("graph", emptyList()),
),
)
val result = trigger.evaluate(report)
assertNull(result)
}
}