(t *testing.T)
| 215 | } |
| 216 | |
| 217 | func 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 | } |
nothing calls this directly
no test coverage detected