(t *testing.T)
| 208 | } |
| 209 | |
| 210 | func TestScopeLabels(t *testing.T) { |
| 211 | tests := []struct { |
| 212 | name string |
| 213 | repoName string |
| 214 | wantFirst []string |
| 215 | wantSecond []string |
| 216 | }{ |
| 217 | { |
| 218 | name: "without repo name", |
| 219 | repoName: "", |
| 220 | wantFirst: []string{"Project", "recommended"}, |
| 221 | wantSecond: []string{"Global"}, |
| 222 | }, |
| 223 | { |
| 224 | name: "with repo name", |
| 225 | repoName: "monalisa/octocat-skills", |
| 226 | wantFirst: []string{"monalisa/octocat-skills", "recommended"}, |
| 227 | wantSecond: []string{"Global"}, |
| 228 | }, |
| 229 | } |
| 230 | for _, tt := range tests { |
| 231 | t.Run(tt.name, func(t *testing.T) { |
| 232 | labels := ScopeLabels(tt.repoName) |
| 233 | require.Len(t, labels, 2) |
| 234 | for _, s := range tt.wantFirst { |
| 235 | assert.Contains(t, labels[0], s) |
| 236 | } |
| 237 | for _, s := range tt.wantSecond { |
| 238 | assert.Contains(t, labels[1], s) |
| 239 | } |
| 240 | }) |
| 241 | } |
| 242 | } |
nothing calls this directly
no test coverage detected