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

Function TestUpdateIssueConfigWithAllOptions

pkg/workflow/update_issue_test.go:81–157  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

79}
80
81func TestUpdateIssueConfigWithAllOptions(t *testing.T) {
82 // Create temporary directory for test files
83 tmpDir := testutil.TempDir(t, "output-update-issue-all-test")
84
85 // Test case with all options configured
86 testContent := `---
87on:
88 issues:
89 types: [opened]
90permissions:
91 contents: read
92 issues: read
93 pull-requests: read
94engine: claude
95strict: false
96safe-outputs:
97 update-issue:
98 max: 3
99 target: "*"
100 status:
101 title:
102 body: true
103---
104
105# Test Update Issue Full Configuration
106
107This workflow tests the update-issue configuration with all options.
108`
109
110 testFile := filepath.Join(tmpDir, "test-update-issue-full.md")
111 if err := os.WriteFile(testFile, []byte(testContent), 0644); err != nil {
112 t.Fatal(err)
113 }
114
115 compiler := NewCompiler()
116
117 // Parse the workflow data
118 workflowData, err := compiler.ParseWorkflowFile(testFile)
119 if err != nil {
120 t.Fatalf("Unexpected error parsing workflow with full update-issue config: %v", err)
121 }
122
123 // Verify output configuration is parsed correctly
124 if workflowData.SafeOutputs == nil {
125 t.Fatal("Expected output configuration to be parsed")
126 }
127
128 if workflowData.SafeOutputs.UpdateIssues == nil {
129 t.Fatal("Expected update-issue configuration to be parsed")
130 }
131
132 // Check all options
133 if templatableIntValue(workflowData.SafeOutputs.UpdateIssues.Max) != 3 {
134 t.Fatalf("Expected max to be 3, got %d", workflowData.SafeOutputs.UpdateIssues.Max)
135 }
136
137 if workflowData.SafeOutputs.UpdateIssues.Target != "*" {
138 t.Fatalf("Expected target to be '*', got '%s'", workflowData.SafeOutputs.UpdateIssues.Target)

Callers

nothing calls this directly

Calls 4

ParseWorkflowFileMethod · 0.95
TempDirFunction · 0.92
NewCompilerFunction · 0.85
templatableIntValueFunction · 0.85

Tested by

no test coverage detected