(t *testing.T)
| 92 | } |
| 93 | |
| 94 | func TestHandleValidateConfig(t *testing.T) { |
| 95 | tmpDir := t.TempDir() |
| 96 | configPath := filepath.Join(tmpDir, defaultConfigFile) |
| 97 | |
| 98 | // Validate should fail if no config file exists |
| 99 | err := handleValidateConfig(configPath) |
| 100 | if err == nil { |
| 101 | t.Fatal("Expected error when config file doesn't exist") |
| 102 | } |
| 103 | |
| 104 | // Create a valid config and set the required env var |
| 105 | err = handleInitConfig(configPath) |
| 106 | if err != nil { |
| 107 | t.Fatalf("Expected no error creating config, got: %v", err) |
| 108 | } |
| 109 | |
| 110 | os.Setenv("GITHUB_TOKEN", "testtoken") |
| 111 | defer os.Unsetenv("GITHUB_TOKEN") |
| 112 | |
| 113 | err = handleValidateConfig(configPath) |
| 114 | if err != nil { |
| 115 | t.Fatalf("Expected valid config, got: %v", err) |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | func TestHandleValidateConfigInvalidService(t *testing.T) { |
| 120 | tmpDir := t.TempDir() |
nothing calls this directly
no test coverage detected