(t *testing.T)
| 17 | ) |
| 18 | |
| 19 | func 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 := `--- |
| 26 | name: Test Workflow |
| 27 | on: workflow_dispatch |
| 28 | --- |
| 29 | # Test Workflow |
| 30 | This 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 |
| 38 | on: 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 | |
| 57 | func TestCollectWorkflowFiles_WithImports(t *testing.T) { |
| 58 | // Create a temporary directory for testing |
nothing calls this directly
no test coverage detected