(t *testing.T)
| 302 | } |
| 303 | |
| 304 | func TestValidateTargetValue(t *testing.T) { |
| 305 | tests := []struct { |
| 306 | name string |
| 307 | configName string |
| 308 | target string |
| 309 | wantErr bool |
| 310 | errText string |
| 311 | }{ |
| 312 | { |
| 313 | name: "empty target", |
| 314 | configName: "test-config", |
| 315 | target: "", |
| 316 | wantErr: false, |
| 317 | }, |
| 318 | { |
| 319 | name: "triggering", |
| 320 | configName: "test-config", |
| 321 | target: "triggering", |
| 322 | wantErr: false, |
| 323 | }, |
| 324 | { |
| 325 | name: "wildcard", |
| 326 | configName: "test-config", |
| 327 | target: "*", |
| 328 | wantErr: false, |
| 329 | }, |
| 330 | { |
| 331 | name: "positive integer", |
| 332 | configName: "test-config", |
| 333 | target: "42", |
| 334 | wantErr: false, |
| 335 | }, |
| 336 | { |
| 337 | name: "large number", |
| 338 | configName: "test-config", |
| 339 | target: "999999", |
| 340 | wantErr: false, |
| 341 | }, |
| 342 | { |
| 343 | name: "GitHub expression", |
| 344 | configName: "test-config", |
| 345 | target: "${{ github.event.issue.number }}", |
| 346 | wantErr: false, |
| 347 | }, |
| 348 | { |
| 349 | name: "complex GitHub expression", |
| 350 | configName: "test-config", |
| 351 | target: "${{ github.event.pull_request.number || github.event.issue.number }}", |
| 352 | wantErr: false, |
| 353 | }, |
| 354 | { |
| 355 | name: "invalid - event", |
| 356 | configName: "update-issue", |
| 357 | target: "event", |
| 358 | wantErr: true, |
| 359 | errText: "invalid target value for update-issue: \"event\"", |
| 360 | }, |
| 361 | { |
nothing calls this directly
no test coverage detected