package thin import ( "os" "path/filepath" "reflect" "testing" "amadan.net/oficina/equipo/internal/runner/mac" ) // Discovery on a Mac finds no claude: not EQUIPO_CLAUDE_PATH, not one on // the usual paths. The only Claude Code a Mac worker knows is the pinned // one under its install dir, which it verifies and never looks up. func TestMacToolsNeverFindAClaude(t *testing.T) { root := t.TempDir() home, install := filepath.Join(root, "home"), filepath.Join(root, "home", ".local", "lib", "equipo-runner") planted := []string{filepath.Join(root, "env", "claude"), filepath.Join(home, ".local", "bin", "claude")} for _, p := range planted { if err := os.MkdirAll(filepath.Dir(p), 0700); err != nil { t.Fatal(err) } if err := os.WriteFile(p, []byte("#!/bin/sh\necho 2.1.312\n"), 0700); err != nil { t.Fatal(err) } } env := map[string]string{"EQUIPO_CLAUDE_PATH": planted[0]} tools := macTools(install, home, func(k string) string { return env[k] }) v := reflect.ValueOf(tools) for i := range v.NumField() { if f := v.Field(i); f.Kind() == reflect.String { for _, p := range planted { if f.String() == p { t.Fatalf("Tools.%s is the unpinned %s", v.Type().Field(i).Name, p) } } } } if tools.Claude != mac.NewClaudeCLI(home, install) || tools.Claude.Version() != "" { t.Fatalf("Tools.Claude %+v", tools.Claude) } }