package game import ( "os" "path/filepath" "strings" "testing" "thehouseoficarus/internal/casino" "thehouseoficarus/internal/net" "thehouseoficarus/internal/player" "thehouseoficarus/internal/world" ) func TestLookBlackjackFixtureWithoutScenery(t *testing.T) { dir := t.TempDir() if err := os.MkdirAll(filepath.Join(dir, "rooms"), 0755); err != nil { t.Fatal(err) } if err := os.WriteFile(filepath.Join(dir, "rooms", "1.yaml"), []byte("name: Anywhere\ncasino_tables:\n- id: test\n game: blackjack\n blackjack:\n decks: 1\n blackjack_payout: 1.2\n"), 0644); err != nil { t.Fatal(err) } g := &Game{Deps: Deps{World: world.New(dir)}, Casino: casino.NewManager(1)} conn := &casinoTestConn{} sess := &net.Session{Player: player.New("alice"), Conn: conn} sess.Player.RoomID = 1 for _, target := range []string{"blackjack", "blackjack table", "table", "test", "test table"} { conn.data = nil if !g.lookCasinoTable(sess, target, casino.GameBlackjack) { t.Fatalf("did not match %q", target) } text := plainRoulette(string(conn.data)) for _, want := range []string{"DECKS", "1", "BLACKJACK PAYS 6 TO 5", "AFTER SPLIT" + strings.Repeat(" ", 21) + "YES"} { if !strings.Contains(text, want) { t.Fatalf("look %s missing %q: %s", target, want, text) } } } if g.lookCasinoTable(sess, "other", casino.GameBlackjack) { t.Fatal("matched unrelated target") } }