(t *testing.T)
| 222 | } |
| 223 | |
| 224 | func TestPromptForSkillOrigin(t *testing.T) { |
| 225 | tests := []struct { |
| 226 | name string |
| 227 | input string |
| 228 | wantOK bool |
| 229 | wantOwner string |
| 230 | wantRepo string |
| 231 | wantReason string |
| 232 | }{ |
| 233 | { |
| 234 | name: "valid owner/repo", |
| 235 | input: "monalisa/awesome-copilot", |
| 236 | wantOK: true, |
| 237 | wantOwner: "monalisa", |
| 238 | wantRepo: "awesome-copilot", |
| 239 | }, |
| 240 | { |
| 241 | name: "empty input skips", |
| 242 | input: "", |
| 243 | wantOK: false, |
| 244 | }, |
| 245 | { |
| 246 | name: "invalid format returns reason", |
| 247 | input: "just-a-name", |
| 248 | wantOK: false, |
| 249 | wantReason: "invalid repository", |
| 250 | }, |
| 251 | } |
| 252 | |
| 253 | for _, tt := range tests { |
| 254 | t.Run(tt.name, func(t *testing.T) { |
| 255 | pm := &prompter.PrompterMock{ |
| 256 | InputFunc: func(prompt string, defaultValue string) (string, error) { |
| 257 | return tt.input, nil |
| 258 | }, |
| 259 | } |
| 260 | |
| 261 | owner, repo, reason, ok, err := promptForSkillOrigin(pm, "test-skill") |
| 262 | require.NoError(t, err) |
| 263 | assert.Equal(t, tt.wantOK, ok) |
| 264 | assert.Equal(t, tt.wantOwner, owner) |
| 265 | assert.Equal(t, tt.wantRepo, repo) |
| 266 | if tt.wantReason != "" { |
| 267 | assert.Contains(t, reason, tt.wantReason) |
| 268 | } |
| 269 | }) |
| 270 | } |
| 271 | } |
| 272 | |
| 273 | func TestScanAllAgentsDeduplicatesSharedProjectDirs(t *testing.T) { |
| 274 | repoDir := t.TempDir() |
nothing calls this directly
no test coverage detected