aboutsummaryrefslogtreecommitdiff
path: root/internal/casino/roulette_test.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-09-29 19:48:32 -0400
committerhistoria <[not public]>2026-09-29 19:48:32 -0400
commitffc7b582e9c14fdc2e579b9239b5ff7ad9a0d90a (patch)
treee286210755094b41025f2947e412e05e59ec2ac9 /internal/casino/roulette_test.go
parent624626b9a10ae47cf7d5f6e91765570ed759bd74 (diff)
downloadthehouseoficarus-ffc7b582e9c14fdc2e579b9239b5ff7ad9a0d90a.tar.gz
feat: roulette history tracker
Diffstat (limited to 'internal/casino/roulette_test.go')
-rw-r--r--internal/casino/roulette_test.go25
1 files changed, 24 insertions, 1 deletions
diff --git a/internal/casino/roulette_test.go b/internal/casino/roulette_test.go
index 0a43677..9a62236 100644
--- a/internal/casino/roulette_test.go
+++ b/internal/casino/roulette_test.go
@@ -307,7 +307,12 @@ func TestRouletteTimedPhasesAndSettlement(t *testing.T) {
t.Fatalf("bad settlement: %+v", w)
}
s := events[0].Snapshot.(*RouletteSnapshot)
- if s.Pockets != [3]string{wheel[(index+len(wheel)-1)%len(wheel)], wheel[index], wheel[(index+1)%len(wheel)]} {
+ n := len(wheel)
+ wantPockets := [5]string{
+ wheel[(index-2+n)%n], wheel[(index-1+n)%n], wheel[index],
+ wheel[(index+1)%n], wheel[(index+2)%n],
+ }
+ if s.Pockets != wantPockets {
t.Fatal("incorrect wheel neighbors")
}
table.tick()
@@ -317,6 +322,24 @@ func TestRouletteTimedPhasesAndSettlement(t *testing.T) {
}
}
}
+func TestRouletteBetDoesNotRedrawBoard(t *testing.T) {
+ table := rouletteFixture()
+ table.join("a")
+ events := table.bet("a", "red", 10, &testWallet{chips: 100})
+ for _, e := range events {
+ if e.Snapshot != nil {
+ t.Fatalf("placing a wager redrew the board: %+v", e)
+ }
+ }
+ // The board is still available on demand and after settlement.
+ for _, e := range table.status("a") {
+ if _, ok := e.Snapshot.(*RouletteSnapshot); ok {
+ return
+ }
+ }
+ t.Fatal("table status did not offer the board")
+}
+
func TestRouletteRefundAndPersistenceFailure(t *testing.T) {
for _, spinning := range []bool{false, true} {
table := rouletteFixture()