MCPcopy Create free account
hub / github.com/github/gh-aw / TestValidateTargetValue

Function TestValidateTargetValue

pkg/workflow/safe_outputs_target_validation_test.go:304–412  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

302}
303
304func 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 {

Callers

nothing calls this directly

Calls 4

validateTargetValueFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected