From 0e60567a7a0addb9421769ee7be7853bfa8788cb Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Sat, 19 Sep 2026 03:15:59 -0400 Subject: refactor: simplifcation, change how rooms are stored in player yaml, remove legacy code --- internal/game/casino_machine_address_test.go | 31 ++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 internal/game/casino_machine_address_test.go (limited to 'internal/game/casino_machine_address_test.go') diff --git a/internal/game/casino_machine_address_test.go b/internal/game/casino_machine_address_test.go new file mode 100644 index 0000000..3a0280c --- /dev/null +++ b/internal/game/casino_machine_address_test.go @@ -0,0 +1,31 @@ +package game + +import ( + "os" + "path/filepath" + "testing" + + "thehouseoficarus/internal/casino" + "thehouseoficarus/internal/world" +) + +// TestCasinoMachineAddressableByID: a slot cabinet's authored id must be a +// usable address. The shipped room declares `id: huff_puff_01` with a variant, +// and matching only the variant/game left the cabinet unreachable as +// `play huff_puff_01`. +func TestCasinoMachineAddressableByID(t *testing.T) { + dir := t.TempDir() + if err := os.MkdirAll(filepath.Join(dir, "rooms"), 0755); err != nil { + t.Fatal(err) + } + room := "name: Casino\ncasino_machines:\n - id: huff_puff_01\n game: slots\n variant: huff_and_even_more_puff\n" + if err := os.WriteFile(filepath.Join(dir, "rooms", "1.yaml"), []byte(room), 0644); err != nil { + t.Fatal(err) + } + g := &Game{Deps: Deps{World: world.New(dir)}, Casino: casino.NewManager(1)} + + machine, ok := g.casinoMachine(1, "huff_puff_01") + if !ok || machine == nil { + t.Fatal("machine id huff_puff_01 is not addressable") + } +} -- cgit v1.2.3