(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func 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 := `--- |
| 19 | on: |
| 20 | issues: |
| 21 | types: [opened] |
| 22 | permissions: |
| 23 | contents: read |
| 24 | issues: read |
| 25 | pull-requests: read |
| 26 | engine: claude |
| 27 | strict: false |
| 28 | safe-outputs: |
| 29 | update-issue: |
| 30 | --- |
| 31 | |
| 32 | # Test Update Issue Configuration |
| 33 | |
| 34 | This 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 | } |
nothing calls this directly
no test coverage detected