aboutsummaryrefslogtreecommitdiff
path: root/internal/game/casino_test.go
blob: b2b37c4f63d0aa501e8b2571a26fcc544150f094 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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)
	}
}