(t *testing.T)
| 102 | } |
| 103 | |
| 104 | func TestNormalizeRepoForAPI(t *testing.T) { |
| 105 | tests := []struct { |
| 106 | name string |
| 107 | repo string |
| 108 | wantOwnerRepo string |
| 109 | wantHost string |
| 110 | }{ |
| 111 | {"plain owner/repo", "owner/repo", "owner/repo", ""}, |
| 112 | {"GHES HOST/owner/repo", "myhost.com/owner/repo", "owner/repo", "myhost.com"}, |
| 113 | {"github.com/owner/repo treated as host prefix", "github.com/owner/repo", "owner/repo", "github.com"}, |
| 114 | } |
| 115 | |
| 116 | for _, tt := range tests { |
| 117 | t.Run(tt.name, func(t *testing.T) { |
| 118 | ownerRepo, host := repoutil.NormalizeRepoForAPI(tt.repo) |
| 119 | assert.Equal(t, tt.wantOwnerRepo, ownerRepo, "owner/repo portion") |
| 120 | assert.Equal(t, tt.wantHost, host, "host portion") |
| 121 | }) |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | func TestIsBotUser(t *testing.T) { |
| 126 | assert.True(t, isBotUser("github-actions[bot]"), "github-actions[bot] is a bot") |
nothing calls this directly
no test coverage detected