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

Function TestNormalizeRepoForAPI

pkg/repoutil/repoutil_test.go:217–236  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

215}
216
217func TestNormalizeRepoForAPI(t *testing.T) {
218 tests := []struct {
219 name string
220 repo string
221 wantOwnerRepo string
222 wantHost string
223 }{
224 {"plain owner/repo", "owner/repo", "owner/repo", ""},
225 {"GHES HOST/owner/repo", "myhost.com/owner/repo", "owner/repo", "myhost.com"},
226 {"github.com/owner/repo treated as host prefix", "github.com/owner/repo", "owner/repo", "github.com"},
227 }
228
229 for _, tt := range tests {
230 t.Run(tt.name, func(t *testing.T) {
231 ownerRepo, host := NormalizeRepoForAPI(tt.repo)
232 assert.Equal(t, tt.wantOwnerRepo, ownerRepo, "owner/repo portion")
233 assert.Equal(t, tt.wantHost, host, "host portion")
234 })
235 }
236}

Callers

nothing calls this directly

Calls 2

NormalizeRepoForAPIFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected