Files
event-demo/src/test/kotlin/eventDemo/libs/command/CommandUnicityCheckerTest.kt
T
flecomte e2d7942c7e
Tests / build (push) Successful in 7m14s
Tests / lint (push) Successful in 8m35s
Tests / test (push) Failing after 11m0s
refactoring: Masive refactor to build the V2
2026-07-30 23:01:50 +02:00

35 lines
1.0 KiB
Kotlin

package eventDemo.libs.command
import eventDemo.testHelpers.spyPing
import io.kotest.core.spec.style.FunSpec
import org.junit.jupiter.api.assertThrows
import kotlin.time.Duration.Companion.seconds
class CommandUnicityCheckerTest :
FunSpec({
test("runOnlyOnce must run all commands") {
spyPing(exactly = 2, duration = 3.seconds) { ping ->
val com1 = CommandForTest(CommandId())
val com2 = CommandForTest(CommandId())
CommandUnicityChecker<CommandForTest>().run {
runOnlyOnce(com1) { ping() }
runOnlyOnce(com2) { ping() }
}
}
}
test("runOnlyOnce") {
spyPing(exactly = 2, duration = 3.seconds) { ping ->
val com1 = CommandForTest(CommandId())
val com2 = CommandForTest(CommandId())
CommandUnicityChecker<CommandForTest>().run {
runOnlyOnce(com1) { ping() }
runOnlyOnce(com2) { ping() }
assertThrows<CommandUnicityChecker.UnicityException> {
runOnlyOnce(com2) { ping() }
}
}
}
}
})