Last active
December 2, 2019 05:13
-
-
Save justinhj/f1f6739fd86833b629d62d08ae36ecb5 to your computer and use it in GitHub Desktop.
This file contains 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
"handle deposit and successful withdrawal" in withTestDriver | |
{ driver => | |
val t1 = Instant.now | |
val t2 = t1.plusSeconds(100) | |
val outcome = driver.run(DepositCmd(t1, "Opening deposit", 100)) | |
outcome.replies should contain only 100 | |
val outcome2 = driver.run(WithdrawCmd(t2, "Transfer to savings", 20)) | |
outcome2.replies should contain only SuccessfulWithdrawalResponse(80) | |
outcome2.issues should be(Nil) | |
outcome2.state should ===(AccountState(80)) | |
outcome2.events should ===(Vector(WithdrawEvt(t2, "Transfer to savings", 20))) | |
} | |
"handle deposit and failed withdrawal" in withTestDriver | |
{ driver => | |
val outcome = driver.run(DepositCmd(Instant.now, "Opening deposit", 100)) | |
outcome.replies should contain only 100 | |
val outcome2 = driver.run(WithdrawCmd(Instant.now, "Transfer to savings", 200)) | |
outcome2.replies should contain only FailedWithdrawalResponse("Insufficient funds (current balance 100)") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment