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

Function TestLocalWorkflowIntegration

pkg/cli/local_workflow_integration_test.go:13–86  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

11)
12
13func 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 := `---
37description: "Test local workflow"
38on:
39 push:
40 branches: [main]
41permissions:
42 contents: read
43engine: claude
44tools:
45 github:
46 allowed: [list_commits]
47---
48
49# Test Local Workflow
50
51This 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" {

Callers

nothing calls this directly

Calls 4

TempDirFunction · 0.92
parseWorkflowSpecFunction · 0.85
ErrorfMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected