(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestExtractBaseRepo_Integration(t *testing.T) { |
| 12 | // Test that extractBaseRepo correctly handles real-world action paths |
| 13 | // from actions-lock.json |
| 14 | realWorldCases := map[string]string{ |
| 15 | // Actions with subfolders (the problematic cases) |
| 16 | "actions/cache/restore": "actions/cache", |
| 17 | "actions/cache/save": "actions/cache", |
| 18 | "github/codeql-action/upload-sarif": "github/codeql-action", |
| 19 | "github/codeql-action/analyze": "github/codeql-action", |
| 20 | "github/codeql-action/init": "github/codeql-action", |
| 21 | |
| 22 | // Regular actions (should remain unchanged) |
| 23 | "actions/checkout": "actions/checkout", |
| 24 | "actions/setup-node": "actions/setup-node", |
| 25 | "actions/setup-python": "actions/setup-python", |
| 26 | "actions/setup-go": "actions/setup-go", |
| 27 | "github/stale-repos": "github/stale-repos", |
| 28 | "actions/ai-inference": "actions/ai-inference", |
| 29 | "actions/create-github-app-token": "actions/create-github-app-token", |
| 30 | } |
| 31 | |
| 32 | for actionPath, expectedBase := range realWorldCases { |
| 33 | t.Run(actionPath, func(t *testing.T) { |
| 34 | got := gitutil.ExtractBaseRepo(actionPath) |
| 35 | if got != expectedBase { |
| 36 | t.Errorf("gitutil.ExtractBaseRepo(%q) = %q, want %q", actionPath, got, expectedBase) |
| 37 | } |
| 38 | }) |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | // TestExtractBaseRepoAPICompatibility verifies that the base repo can be used |
| 43 | // to construct valid GitHub API URLs |
nothing calls this directly
no test coverage detected