diff options
| author | historia <[not public]> | 2026-09-24 20:06:41 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-24 20:07:31 -0400 |
| commit | 13db3e50cb6e29eedbf25416e5284bf08b0adefb (patch) | |
| tree | d5e9b99030b25cc7fc102288b694c133f8832f84 /internal/game/casino_test.go | |
| parent | d114c747a7672c7e4daab3a5b5f1b2f066ebc912 (diff) | |
| download | thehouseoficarus-13db3e50cb6e29eedbf25416e5284bf08b0adefb.tar.gz | |
feat: casino table ux: aliases, rebet hints, deadline notifications, spectator mode
Diffstat (limited to 'internal/game/casino_test.go')
| -rw-r--r-- | internal/game/casino_test.go | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/internal/game/casino_test.go b/internal/game/casino_test.go index ffd9958..b3bfb9b 100644 --- a/internal/game/casino_test.go +++ b/internal/game/casino_test.go @@ -1,6 +1,7 @@ package game import ( + "regexp" "strings" "testing" "time" @@ -108,7 +109,7 @@ func TestCasinoMenuRendersAlignedColoredCommands(t *testing.T) { {Command: "spin", Desc: "Spin using your current wager"}, }} msg := g.casinoPrivateMessage(sess, "casino_menu", menu, "Your slot machine bet is set to 10.") - if !strings.Contains(msg, "You have 0 chips and 0 credits.") { + if !strings.Contains(regexp.MustCompile(`\x1b\[[0-9;]*m`).ReplaceAllString(msg, ""), "Available 0 (0 chips + 0 credits)") { t.Fatalf("missing balance line: %q", msg) } // Commands are painted with the "command" color (0A bold). @@ -176,11 +177,11 @@ func TestRenderBlackjackSnapshotUsesCompactASCIIArt(t *testing.T) { Dealer: []casino.CardView{{Rank: "?", Hidden: true}, {Rank: "K", Suit: "hearts"}}, Players: []casino.BlackjackPlayerView{{Name: "alice", Score: "20", Cards: []casino.CardView{{Rank: "5", Suit: "clubs"}, {Rank: "Q", Suit: "spades"}}}}, } - plain := renderBlackjackSnapshot(snapshot, "none", false, 5, "dark", nil) + plain := renderBlackjackSnapshotFor(snapshot, "none", false, 5, "dark", nil, "") if !strings.Contains(plain, "+---+") || !strings.Contains(plain, "Dealer:") || !strings.Contains(plain, "alice (20):") { t.Fatalf("unexpected blackjack art: %q", plain) } - output := renderBlackjackSnapshot(snapshot, "xterm256", false, 5, "dark", nil) + output := renderBlackjackSnapshotFor(snapshot, "xterm256", false, 5, "dark", nil, "") if !strings.Contains(output, "\033[38;5;") { t.Fatalf("expected colored blackjack art: %q", output) } @@ -192,15 +193,15 @@ func TestRenderBlackjackSnapshotUsesCompactASCIIArt(t *testing.T) { t.Fatalf("blackjack line exceeds console width: %d", color.VisibleLen(line)) } } - unicodeOutput := renderBlackjackSnapshot(snapshot, "none", true, 7, "dark", nil) + unicodeOutput := renderBlackjackSnapshotFor(snapshot, "none", true, 7, "dark", nil, "") if !strings.Contains(unicodeOutput, "│5 │") || !strings.Contains(unicodeOutput, "│ 5│") || !strings.Contains(unicodeOutput, "│ ♣ │") { t.Fatalf("unexpected Unicode card alignment: %q", unicodeOutput) } - coloredUnicode := renderBlackjackSnapshot(snapshot, "xterm256", true, 7, "dark", nil) + coloredUnicode := renderBlackjackSnapshotFor(snapshot, "xterm256", true, 7, "dark", nil, "") if !strings.Contains(coloredUnicode, "\033[38;5;15m") || !strings.Contains(coloredUnicode, "\033[38;5;27m") { t.Fatalf("expected white borders and blue card art: %q", coloredUnicode) } - light := renderBlackjackSnapshot(snapshot, "xterm256", true, 7, "light", nil) + light := renderBlackjackSnapshotFor(snapshot, "xterm256", true, 7, "light", nil, "") if !strings.Contains(light, "\033[48;5;15m") { t.Fatalf("expected white card background in light style: %q", light) } @@ -208,7 +209,7 @@ func TestRenderBlackjackSnapshotUsesCompactASCIIArt(t *testing.T) { if strings.Contains(lightLines[1], "\033[48;5;15m") || strings.Contains(lightLines[7], "\033[48;5;15m") { t.Fatalf("card edges should not have a background: %q", light) } - lightPlain := renderBlackjackSnapshot(snapshot, "none", true, 7, "light", nil) + lightPlain := renderBlackjackSnapshotFor(snapshot, "none", true, 7, "light", nil, "") if !strings.Contains(lightPlain, "▀▀▀▀▀▀▀") || !strings.Contains(lightPlain, "▄▄▄▄▄▄▄") { t.Fatalf("expected half-height light card edges: %q", lightPlain) } |
