aboutsummaryrefslogtreecommitdiff
path: root/internal/game/casino_look_test.go
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-10-02 14:43:26 -0400
committerhistoria <[not public]>2026-10-02 14:43:26 -0400
commit4f40f116ba884111c9a66849e620ff9fbc67530a (patch)
treeaf407f199be482f9aac997d2cfaa0d86a806d8ff /internal/game/casino_look_test.go
parent62017c86392b046d746fb4fafef6742840477c5f (diff)
downloadthehouseoficarus-4f40f116ba884111c9a66849e620ff9fbc67530a.tar.gz
feat: compact craps layout, ux cleanup
Diffstat (limited to 'internal/game/casino_look_test.go')
-rw-r--r--internal/game/casino_look_test.go47
1 files changed, 47 insertions, 0 deletions
diff --git a/internal/game/casino_look_test.go b/internal/game/casino_look_test.go
index 4c464f1..cdb0b59 100644
--- a/internal/game/casino_look_test.go
+++ b/internal/game/casino_look_test.go
@@ -88,3 +88,50 @@ func TestLookStandingShowsFixtureOnly(t *testing.T) {
t.Fatalf("standing look missing the play hint: %q", text)
}
}
+
+// TestLookCasinoRoomSingleBlankBeforeExits pins the room-look spacing: the
+// casino fixture listing and the exit section are separated by one blank
+// line, whether or not the mini-map supplies trailing rows of its own.
+func TestLookCasinoRoomSingleBlankBeforeExits(t *testing.T) {
+ for _, mapOpt := range []string{"off", "right"} {
+ t.Run(mapOpt, func(t *testing.T) {
+ h := newHarness(t)
+ h.seedAccount("alice")
+ h.seedCharacter("alice", "alice")
+ sess, conn := h.connect("alice")
+ sess.Player.Options = map[string]any{"tiny_map": mapOpt}
+
+ room := "id: 4\nname: Bank Craps Pit\ndescription: A sweeping green felt table curves beneath warm brass lamps. Ivory dice rest beside a polished stick.\nexits:\n north:\n room: 1\ncasino_tables:\n - id: bank_craps\n game: craps\n craps:\n variant: bank\n"
+ path := filepath.Join(h.dir, "rooms", "4.yaml")
+ if err := os.WriteFile(path, []byte(room), 0644); err != nil {
+ t.Fatal(err)
+ }
+ h.g.World.AddRoomPath(4, path)
+ sess.Player.RoomID = 4
+ h.hub.EnterRoom(sess, 4)
+
+ h.g.executeLook(sess, nil, "look")
+ lines := strings.Split(lookOutput(t, conn), "\n")
+ play, exits := -1, -1
+ for i, line := range lines {
+ if strings.Contains(line, "play craps") {
+ play = i
+ }
+ if strings.TrimSpace(line) == "Exits:" {
+ exits = i
+ }
+ }
+ if play < 0 || exits < 0 || exits <= play {
+ t.Fatalf("could not locate table/exits: %q", lines)
+ }
+ for i := play; i < exits; i++ {
+ if strings.TrimSpace(lines[i]) != "" {
+ continue
+ }
+ if i+1 < exits && strings.TrimSpace(lines[i+1]) == "" {
+ t.Fatalf("consecutive blank lines before Exits: %q", lines)
+ }
+ }
+ })
+ }
+}