TestSpec_PublicAPI_ExtractBaseRepo validates the documented behavior of ExtractBaseRepo as described in the package README.md. Specification: Extracts the owner/repo portion from an action path that may include a sub-folder. Documented examples: gitutil.ExtractBaseRepo("actions/checkout")
(t *testing.T)
| 191 | // gitutil.ExtractBaseRepo("actions/checkout") → "actions/checkout" |
| 192 | // gitutil.ExtractBaseRepo("github/codeql-action/upload-sarif") → "github/codeql-action" |
| 193 | func TestSpec_PublicAPI_ExtractBaseRepo(t *testing.T) { |
| 194 | tests := []struct { |
| 195 | name string |
| 196 | input string |
| 197 | expected string |
| 198 | }{ |
| 199 | { |
| 200 | name: "two-segment path returns as-is (documented example)", |
| 201 | input: "actions/checkout", |
| 202 | expected: "actions/checkout", |
| 203 | }, |
| 204 | { |
| 205 | name: "three-segment path strips sub-folder (documented example)", |
| 206 | input: "github/codeql-action/upload-sarif", |
| 207 | expected: "github/codeql-action", |
| 208 | }, |
| 209 | { |
| 210 | name: "four-segment path returns owner/repo only", |
| 211 | input: "owner/repo/sub/path", |
| 212 | expected: "owner/repo", |
| 213 | }, |
| 214 | } |
| 215 | |
| 216 | for _, tt := range tests { |
| 217 | t.Run(tt.name, func(t *testing.T) { |
| 218 | result := gitutil.ExtractBaseRepo(tt.input) |
| 219 | assert.Equal(t, tt.expected, result, |
| 220 | "ExtractBaseRepo(%q) should extract owner/repo portion", tt.input) |
| 221 | }) |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | // TestSpec_PublicAPI_IsValidFullSHA validates the documented behavior of |
| 226 | // IsValidFullSHA as described in the package README.md. |
nothing calls this directly
no test coverage detected