package scanner import ( "strings" "testing" ) func TestScanSystem(t *testing.T) { InvalidateCache() result := ScanSystem() if result == nil { t.Fatal("ScanSystem should not return nil") } if result.System.OS == "" { t.Error("System OS should not be empty") } } func TestScanTools(t *testing.T) { tools := scanTools() if len(tools) == 0 { t.Error("Should scan at least some tools") } for _, tool := range tools { if tool.Name == "" { t.Error("Tool name should not be empty") } } } func TestScanRuntimes(t *testing.T) { runtimes := scanRuntimes() if len(runtimes) == 0 { t.Error("Should scan at least some runtimes") } for _, r := range runtimes { if r.Name == "" { t.Error("Runtime name should not be empty") } } } func TestCheckGitConfig(t *testing.T) { _ = checkGitConfig() } func TestCheckShellSetup(t *testing.T) { _ = checkShellSetup() } func TestSummary(t *testing.T) { InvalidateCache() result := ScanSystem() summary := result.Summary() if summary == "" { t.Error("Summary should not be empty") } if !strings.Contains(summary, "System:") { t.Error("Summary should contain System:") } if !strings.Contains(summary, "Tools:") { t.Error("Summary should contain Tools:") } if !strings.Contains(summary, "Runtimes:") { t.Error("Summary should contain Runtimes:") } } func TestScanCache(t *testing.T) { InvalidateCache() r1 := ScanSystem() r2 := ScanSystem() if r1 != r2 { t.Error("Cached result should be the same pointer") } }