From a2cbc04f86508708daa09affa5e9d73cc689b2ba Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Mon, 3 Aug 2026 17:15:50 -0400 Subject: feat: new color 'command', color tag system implemented --- internal/game/casino_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'internal/game/casino_test.go') diff --git a/internal/game/casino_test.go b/internal/game/casino_test.go index 0394437..8affe29 100644 --- a/internal/game/casino_test.go +++ b/internal/game/casino_test.go @@ -81,6 +81,29 @@ func TestExecuteBetParsesBaccaratSpots(t *testing.T) { } } +func TestCasinoMenuRendersAlignedColoredCommands(t *testing.T) { + g := &Game{Casino: casino.NewManager(1)} + conn := &casinoTestConn{} + sess := &net.Session{Player: player.New("alice"), Conn: conn} + g.loggedInChars = map[string]*net.Session{"alice": sess} + menu := &casino.MenuView{Kind: casino.MenuSlotCommands, Commands: []casino.MenuCommand{ + {Command: "bet ", Desc: "Set your wager"}, + {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.") { + t.Fatalf("missing balance line: %q", msg) + } + // Commands are painted with the "command" color (0A bold). + if !strings.Contains(msg, "\033[1m\033[38;5;10mbet \033[0m") { + t.Fatalf("command not colored: %q", msg) + } + // Shorter commands are right-padded to align the descriptions. + if !strings.Contains(msg, "\033[1m\033[38;5;10mspin \033[0m Spin using your current wager") { + t.Fatalf("commands not aligned: %q", msg) + } +} + func TestRenderBaccaratSnapshot(t *testing.T) { snapshot := &casino.BaccaratSnapshot{ Player: []casino.CardView{{Rank: "5", Suit: "clubs"}, {Rank: "4", Suit: "hearts"}}, -- cgit v1.2.3