MCPcopy Create free account
hub / github.com/github/gh-aw / TestSpec_PublicAPI_ExtractBaseRepo

Function TestSpec_PublicAPI_ExtractBaseRepo

pkg/gitutil/spec_test.go:193–223  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

191// gitutil.ExtractBaseRepo("actions/checkout") → "actions/checkout"
192// gitutil.ExtractBaseRepo("github/codeql-action/upload-sarif") → "github/codeql-action"
193func 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.

Callers

nothing calls this directly

Calls 2

ExtractBaseRepoFunction · 0.92
RunMethod · 0.45

Tested by

no test coverage detected