Last active
December 8, 2024 14:51
-
-
Save emag/f31d8b9a10c1e068ffed33c2fdc9f16f to your computer and use it in GitHub Desktop.
サービスのテスト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cats.Id | |
"初期化" should { | |
"コマンドを受け付ける" in { | |
// Given | |
val initA = Map(Cash -> BigDecimal(1_000_000)) | |
val initL = Map(AccruedLiability -> BigDecimal(100_000)) | |
val initializeScenario = RequestContext( | |
command = CommandMessage( | |
id = "some-id", | |
time = ZonedDateTime.now().toInstant, | |
address = "an-address-id", | |
payload = BsCommand.Initialize(initA, initL) | |
), | |
state = BalanceSheet.NotReady | |
) | |
// When | |
val result: EdomatonResult[ | |
BalanceSheet, | |
BsEvent, | |
BsRejection, | |
BsNotification | |
] = BalanceSheetService[Id].execute(initializeScenario) | |
// Then | |
result shouldBe Accepted( | |
newState = BalanceSheet.Ready(initA, initL), | |
events = NonEmptyChain(BsEvent.Initialized(initA, initL)), | |
notifications = Chain( | |
BsNotification.BalanceSheetPrepared( | |
"an-address-id", | |
BalanceSheet.Ready(initA, initL) | |
) | |
) | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment