diff options
Diffstat (limited to 'internal/game/casino_test.go')
| -rw-r--r-- | internal/game/casino_test.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/internal/game/casino_test.go b/internal/game/casino_test.go new file mode 100644 index 0000000..b2b37c4 --- /dev/null +++ b/internal/game/casino_test.go @@ -0,0 +1,29 @@ +package game + +import ( + "strings" + "testing" + + "thehouseoficarus/internal/casino" + "thehouseoficarus/internal/color" +) + +func TestRenderSlotSnapshotColorsWordSymbols(t *testing.T) { + snapshot := &casino.SlotSnapshot{StoppedReels: 1} + snapshot.Grid[0][0] = "scatter" + if !strings.Contains(renderSlotSnapshot(snapshot, "none", false), "scatter") { + t.Fatal("expected word-based slot symbols") + } + output := renderSlotSnapshot(snapshot, "xterm256", true) + if !strings.Contains(output, "\033[38;5;") { + t.Fatalf("expected colored slot symbols, got %q", output) + } + for _, line := range strings.Split(output, "\n") { + if color.VisibleLen(line) != 51 { + t.Fatalf("line visible width = %d, want 51: %q", color.VisibleLen(line), line) + } + } + if !strings.Contains(output, "┌") || !strings.Contains(output, "└") { + t.Fatalf("slot output lacks the Unicode frame: %q", output) + } +} |
