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

Function TestUpdateIssueConfigParsing

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

Source from the content-addressed store, hash-verified

11)
12
13func TestUpdateIssueConfigParsing(t *testing.T) {
14 // Create temporary directory for test files
15 tmpDir := testutil.TempDir(t, "output-update-issue-test")
16
17 // Test case with basic update-issue configuration
18 testContent := `---
19on:
20 issues:
21 types: [opened]
22permissions:
23 contents: read
24 issues: read
25 pull-requests: read
26engine: claude
27strict: false
28safe-outputs:
29 update-issue:
30---
31
32# Test Update Issue Configuration
33
34This workflow tests the update-issue configuration parsing.
35`
36
37 testFile := filepath.Join(tmpDir, "test-update-issue.md")
38 if err := os.WriteFile(testFile, []byte(testContent), 0644); err != nil {
39 t.Fatal(err)
40 }
41
42 compiler := NewCompiler()
43
44 // Parse the workflow data
45 workflowData, err := compiler.ParseWorkflowFile(testFile)
46 if err != nil {
47 t.Fatalf("Unexpected error parsing workflow with update-issue config: %v", err)
48 }
49
50 // Verify output configuration is parsed correctly
51 if workflowData.SafeOutputs == nil {
52 t.Fatal("Expected output configuration to be parsed")
53 }
54
55 if workflowData.SafeOutputs.UpdateIssues == nil {
56 t.Fatal("Expected update-issue configuration to be parsed")
57 }
58
59 // Check defaults
60 if templatableIntValue(workflowData.SafeOutputs.UpdateIssues.Max) != 1 {
61 t.Fatalf("Expected max to be 1, got %d", workflowData.SafeOutputs.UpdateIssues.Max)
62 }
63
64 if workflowData.SafeOutputs.UpdateIssues.Target != "" {
65 t.Fatalf("Expected target to be empty (default), got '%s'", workflowData.SafeOutputs.UpdateIssues.Target)
66 }
67
68 if workflowData.SafeOutputs.UpdateIssues.Status != nil {
69 t.Fatal("Expected status to be nil by default (not updatable)")
70 }

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