(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestLocalWorkflowIntegration(t *testing.T) { |
| 14 | // Create a temporary directory |
| 15 | tempDir := testutil.TempDir(t, "test-*") |
| 16 | originalWd, err := os.Getwd() |
| 17 | if err != nil { |
| 18 | t.Fatal(err) |
| 19 | } |
| 20 | defer os.Chdir(originalWd) |
| 21 | |
| 22 | // Change to temp directory |
| 23 | err = os.Chdir(tempDir) |
| 24 | if err != nil { |
| 25 | t.Fatal(err) |
| 26 | } |
| 27 | |
| 28 | // Create a test workflow file |
| 29 | workflowsDir := "workflows" |
| 30 | err = os.MkdirAll(workflowsDir, 0755) |
| 31 | if err != nil { |
| 32 | t.Fatal(err) |
| 33 | } |
| 34 | |
| 35 | testWorkflowPath := filepath.Join(workflowsDir, "test-local.md") |
| 36 | testContent := `--- |
| 37 | description: "Test local workflow" |
| 38 | on: |
| 39 | push: |
| 40 | branches: [main] |
| 41 | permissions: |
| 42 | contents: read |
| 43 | engine: claude |
| 44 | tools: |
| 45 | github: |
| 46 | allowed: [list_commits] |
| 47 | --- |
| 48 | |
| 49 | # Test Local Workflow |
| 50 | |
| 51 | This is a test local workflow. |
| 52 | ` |
| 53 | |
| 54 | err = os.WriteFile(testWorkflowPath, []byte(testContent), 0644) |
| 55 | if err != nil { |
| 56 | t.Fatal(err) |
| 57 | } |
| 58 | |
| 59 | // Test parsing local workflow spec |
| 60 | // Local workflows don't require a git repository or remote |
| 61 | spec, err := parseWorkflowSpec("./workflows/test-local.md") |
| 62 | if err != nil { |
| 63 | t.Fatalf("Failed to parse local workflow spec: %v", err) |
| 64 | } |
| 65 | |
| 66 | // Verify parsed spec |
| 67 | if spec.WorkflowPath != "./workflows/test-local.md" { |
| 68 | t.Errorf("Expected WorkflowPath './workflows/test-local.md', got %q", spec.WorkflowPath) |
| 69 | } |
| 70 | if spec.WorkflowName != "test-local" { |
nothing calls this directly
no test coverage detected