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

Function TestCollectWorkflowFiles_SimpleWorkflow

pkg/cli/run_push_test.go:19–55  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

17)
18
19func TestCollectWorkflowFiles_SimpleWorkflow(t *testing.T) {
20 // Create a temporary directory for testing
21 tmpDir := t.TempDir()
22
23 // Create a simple workflow file
24 workflowPath := filepath.Join(tmpDir, "test-workflow.md")
25 workflowContent := `---
26name: Test Workflow
27on: workflow_dispatch
28---
29# Test Workflow
30This is a test workflow.
31`
32 err := os.WriteFile(workflowPath, []byte(workflowContent), 0644)
33 require.NoError(t, err)
34
35 // Create the corresponding lock file
36 lockFilePath := filepath.Join(tmpDir, "test-workflow.lock.yml")
37 lockContent := `name: Test Workflow
38on: workflow_dispatch
39`
40 err = os.WriteFile(lockFilePath, []byte(lockContent), 0644)
41 require.NoError(t, err)
42
43 // Test collecting files
44 files, err := collectWorkflowFiles(context.Background(), workflowPath, false, false)
45 require.NoError(t, err)
46 assert.Len(t, files, 2, "Should collect workflow .md and .lock.yml files")
47
48 // Check that both files are in the result
49 fileSet := make(map[string]bool)
50 for _, file := range files {
51 fileSet[file] = true
52 }
53 assert.True(t, fileSet[workflowPath], "Should include workflow .md file")
54 assert.True(t, fileSet[lockFilePath], "Should include lock .yml file")
55}
56
57func TestCollectWorkflowFiles_WithImports(t *testing.T) {
58 // Create a temporary directory for testing

Callers

nothing calls this directly

Calls 2

collectWorkflowFilesFunction · 0.85
BackgroundMethod · 0.80

Tested by

no test coverage detected