(t *testing.T)
| 79 | } |
| 80 | |
| 81 | func 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 := `--- |
| 87 | on: |
| 88 | issues: |
| 89 | types: [opened] |
| 90 | permissions: |
| 91 | contents: read |
| 92 | issues: read |
| 93 | pull-requests: read |
| 94 | engine: claude |
| 95 | strict: false |
| 96 | safe-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 | |
| 107 | This 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) |
nothing calls this directly
no test coverage detected