(t *testing.T)
| 246 | } |
| 247 | |
| 248 | func TestExtractBaseRepo(t *testing.T) { |
| 249 | tests := []struct { |
| 250 | name string |
| 251 | input string |
| 252 | expected string |
| 253 | }{ |
| 254 | { |
| 255 | name: "simple owner/repo path", |
| 256 | input: "actions/checkout", |
| 257 | expected: "actions/checkout", |
| 258 | }, |
| 259 | { |
| 260 | name: "path with one subpath segment", |
| 261 | input: "github/codeql-action/upload-sarif", |
| 262 | expected: "github/codeql-action", |
| 263 | }, |
| 264 | { |
| 265 | name: "deep path with multiple segments", |
| 266 | input: "owner/repo/sub/dir/file", |
| 267 | expected: "owner/repo", |
| 268 | }, |
| 269 | { |
| 270 | name: "no slash returns input as-is", |
| 271 | input: "onlyone", |
| 272 | expected: "onlyone", |
| 273 | }, |
| 274 | { |
| 275 | name: "empty string returns empty string", |
| 276 | input: "", |
| 277 | expected: "", |
| 278 | }, |
| 279 | } |
| 280 | |
| 281 | for _, tt := range tests { |
| 282 | t.Run(tt.name, func(t *testing.T) { |
| 283 | result := ExtractBaseRepo(tt.input) |
| 284 | assert.Equal(t, tt.expected, result, "ExtractBaseRepo(%q) should return %q", tt.input, tt.expected) |
| 285 | }) |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | func TestFindGitRoot(t *testing.T) { |
| 290 | t.Run("returns non-empty path when inside a git repository", func(t *testing.T) { |
nothing calls this directly
no test coverage detected