aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/craps_review_test.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-10-02 17:51:46 -0400
committerhistoria <[not public]>2026-10-02 17:51:46 -0400
commitcac16d1725c46c82a2e62b84c93f7090b2ce0746 (patch)
treee54f6624bdeb47421587656757ef3ce4fd7ebb3f /internal/casino/craps_review_test.go
parent4f40f116ba884111c9a66849e620ff9fbc67530a (diff)
downloadthehouseoficarus-cac16d1725c46c82a2e62b84c93f7090b2ce0746.tar.gz
feat: craps table color improvements, die improvements
Diffstat (limited to 'internal/casino/craps_review_test.go')
-rw-r--r--internal/casino/craps_review_test.go51
1 files changed, 51 insertions, 0 deletions
diff --git a/internal/casino/craps_review_test.go b/internal/casino/craps_review_test.go
new file mode 100644
index 0000000..04f72b2
--- /dev/null
+++ b/internal/casino/craps_review_test.go
@@ -0,0 +1,51 @@
+package casino
+
+import "testing"
+
+func TestCrapsTakenDownRollDoesNotCarryIntoNewBet(t *testing.T) {
+ tb := crapsFixture()
+ tb.join("alice")
+ w := &testWallet{chips: 100}
+ tb.bet("alice", "field", 10, w)
+ tb.action("alice", "roll")
+ tb.tick()
+ tb.action("alice", "unbet")
+ if tb.pendingRollTicks != 0 {
+ t.Fatal("taking down the last bet did not cancel the pending roll")
+ }
+ tb.bet("alice", "field", 10, w)
+ tb.advance(10)
+ if tb.dice != [2]int{} || !tb.hasLiveBets() {
+ t.Fatal("new wager inherited a canceled roll")
+ }
+ tb.action("alice", "roll")
+ tb.advance(crapsManualRollTicks)
+ if tb.dice == [2]int{} || tb.hasLiveBets() {
+ t.Fatal("fresh manual roll did not settle")
+ }
+}
+
+func TestSimplifiedCrapsDeparturePreservesCountdown(t *testing.T) {
+ for _, departing := range []string{"alice", "bob"} {
+ t.Run(departing, func(t *testing.T) {
+ tb := variantFixture("simplified")
+ tb.join("alice")
+ tb.join("bob")
+ tb.join("carol")
+ tb.bet("carol", "pass", 10, &testWallet{chips: 100})
+ tb.tick()
+ tb.leave(departing)
+ if tb.countdown != 1 || tb.view().ShootIn != 2 {
+ t.Fatal("departure reset the shared countdown")
+ }
+ events := tb.tick()
+ if len(events) != 1 || tb.countdown != 2 {
+ t.Fatal("countdown repeated after departure", events)
+ }
+ tb.tick()
+ if tb.dice == [2]int{} || tb.hasLiveBets() {
+ t.Fatal("shared roll did not settle on schedule")
+ }
+ })
+ }
+}