Skip to content

Commit

Permalink
feat(test): SagaVerifier support same event when different `Functio…
Browse files Browse the repository at this point in the history
…nKind`. (#483)
  • Loading branch information
Ahoo-Wang authored Jan 30, 2024
1 parent 13d3e02 commit 86bab5f
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package me.ahoo.wow.test.saga.stateless

import me.ahoo.wow.api.event.DomainEvent
import me.ahoo.wow.api.messaging.FunctionKind
import me.ahoo.wow.api.modeling.TenantId
import me.ahoo.wow.command.CommandGateway
import me.ahoo.wow.event.DomainEventExchange
Expand Down Expand Up @@ -67,7 +68,14 @@ internal class DefaultWhenStage<T : Any>(
handlerRegistrar.registerProcessor(processor)
val eventExchange = toEventExchange(event, state)
val expectedResultMono = handlerRegistrar.supportedFunctions(eventExchange.message)
.first()
.filter {
if (state != null) {
it.functionKind == FunctionKind.STATE_EVENT
} else {
it.functionKind == FunctionKind.EVENT
}
}
.single()
.invoke(eventExchange)
.map {
ExpectedResult(
Expand Down

0 comments on commit 86bab5f

Please sign in to comment.