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") } }