package platform import ( "runtime" "testing" ) func TestDetect(t *testing.T) { p := Detect() if p.OS != runtime.GOOS { t.Errorf("expected OS=%s, got %s", runtime.GOOS, p.OS) } if p.Arch != runtime.GOARCH { t.Errorf("expected Arch=%s, got %s", runtime.GOARCH, p.Arch) } if runtime.GOOS == "linux" && !p.IsLinux { t.Error("expected IsLinux=true on Linux") } } func TestDataDir(t *testing.T) { p := Detect() dir := p.DataDir() if dir == "" { t.Error("DataDir should not be empty") } } func TestConfigDir(t *testing.T) { p := Detect() dir := p.ConfigDir() if dir == "" { t.Error("ConfigDir should not be empty") } } func TestCacheDir(t *testing.T) { p := Detect() dir := p.CacheDir() if dir == "" { t.Error("CacheDir should not be empty") } } func TestSummary(t *testing.T) { p := Detect() s := p.Summary() if s == "" { t.Error("Summary should not be empty") } // Should contain the OS name if len(s) < 3 { t.Errorf("Summary too short: %s", s) } } func TestDefaultNATSURL(t *testing.T) { p := Detect() url := p.DefaultNATSURL() if url != "nats://localhost:4222" { t.Errorf("expected nats://localhost:4222, got %s", url) } }