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

Function TestHasWorkflowCallTrigger

pkg/workflow/compiler_workflow_call_test.go:306–362  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

304}
305
306func TestHasWorkflowCallTrigger(t *testing.T) {
307 tests := []struct {
308 name string
309 onSection string
310 expected bool
311 }{
312 {
313 name: "workflow_call present in map format",
314 onSection: `"on":
315 workflow_call:`,
316 expected: true,
317 },
318 {
319 name: "workflow_call present with inputs",
320 onSection: `"on":
321 workflow_call:
322 inputs:
323 issue_number:
324 required: true
325 type: number`,
326 expected: true,
327 },
328 {
329 name: "workflow_call absent - push and workflow_dispatch only",
330 onSection: `"on":
331 push:
332 workflow_dispatch:`,
333 expected: false,
334 },
335 {
336 name: "workflow_call with other triggers - issue_comment and workflow_call",
337 onSection: `"on":
338 issue_comment:
339 types: [created]
340 workflow_call:`,
341 expected: true,
342 },
343 {
344 name: "empty string",
345 onSection: "",
346 expected: false,
347 },
348 {
349 name: "workflow_dispatch only - not workflow_call",
350 onSection: `"on":
351 workflow_dispatch:`,
352 expected: false,
353 },
354 }
355
356 for _, tt := range tests {
357 t.Run(tt.name, func(t *testing.T) {
358 result := hasWorkflowCallTrigger(tt.onSection)
359 assert.Equal(t, tt.expected, result, "hasWorkflowCallTrigger() result mismatch for %q", tt.name)
360 })
361 }
362}
363

Callers

nothing calls this directly

Calls 2

hasWorkflowCallTriggerFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected