Skip to content

Commit

Permalink
fixed typo
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodolfo committed Dec 4, 2024
1 parent 0a08a48 commit 155935b
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions src/test/kotlin/crablet/postgres/AccountTransferScenarioTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ import org.junit.jupiter.api.extension.ExtendWith
@TestMethodOrder(MethodOrderer.OrderAnnotation::class)
class AccountTransferScenarioTest : AbstractCrabletTest() {

data class Account(val id: String? = null, val balance: Int = 0)

val eventTypes = listOf("AccountOpened", "AmountDeposited", "AmountTransferred").map { EventName(it) }

@Test
@Order(1)
fun `it can open Account 1 with $100`(testContext: VertxTestContext) {
Expand Down Expand Up @@ -133,11 +129,11 @@ class AccountTransferScenarioTest : AbstractCrabletTest() {
}
.compose {
// assert acct2 state
val domainIdentifiersAcct1 = listOf(
val domainIdentifiersAcct2 = listOf(
DomainIdentifier(name = StateName("Account"), id = StateId("2"))
)
val streamQueryAcct1 = StreamQuery(identifiers = domainIdentifiersAcct1, eventTypes = eventTypes)
stateBuilder.buildFor(streamQueryAcct1)
val streamQueryAcct2 = StreamQuery(identifiers = domainIdentifiersAcct2, eventTypes = eventTypes)
stateBuilder.buildFor(streamQueryAcct2)
.onSuccess { (state, sequence) ->
testContext.verify {
assertEquals(5, sequence.value)
Expand All @@ -157,11 +153,11 @@ class AccountTransferScenarioTest : AbstractCrabletTest() {
companion object {
lateinit var eventsAppender: CrabletEventsAppender
lateinit var stateBuilder: CrabletStateBuilder<Account>

data class Account(val id: String? = null, val balance: Int = 0)
val eventTypes = listOf("AccountOpened", "AmountDeposited", "AmountTransferred").map { EventName(it) }
@BeforeAll
@JvmStatic
fun setUp(testContext: VertxTestContext) {
cleanDatabase()
eventsAppender = CrabletEventsAppender(pool)
stateBuilder = CrabletStateBuilder(
client = pool,
Expand All @@ -177,23 +173,20 @@ class AccountTransferScenarioTest : AbstractCrabletTest() {
event.getInteger("amount")
)
)

event.getString("toAcct") == state.id -> state.copy(
balance = state.balance.plus(
event.getInteger(
"amount"
)
)
)

else -> state
}
}

else -> state
}
})
testContext.completeNow()
cleanDatabase().onSuccess { testContext.completeNow() }
}
}

Expand Down

0 comments on commit 155935b

Please sign in to comment.