TestAddSourceToWorkflow tests the addSourceToWorkflow function
(t *testing.T)
| 9 | |
| 10 | // TestAddSourceToWorkflow tests the addSourceToWorkflow function |
| 11 | func TestAddSourceToWorkflow(t *testing.T) { |
| 12 | tests := []struct { |
| 13 | name string |
| 14 | content string |
| 15 | source string |
| 16 | expectError bool |
| 17 | checkSource bool |
| 18 | }{ |
| 19 | { |
| 20 | name: "add_source_to_workflow_with_frontmatter", |
| 21 | content: `--- |
| 22 | on: push |
| 23 | permissions: |
| 24 | contents: read |
| 25 | engine: claude |
| 26 | --- |
| 27 | |
| 28 | # Test Workflow |
| 29 | |
| 30 | This is a test workflow.`, |
| 31 | source: "githubnext/agentics/workflows/ci-doctor.md@v1.0.0", |
| 32 | expectError: false, |
| 33 | checkSource: true, |
| 34 | }, |
| 35 | { |
| 36 | name: "add_source_to_workflow_without_frontmatter", |
| 37 | content: `# Test Workflow |
| 38 | |
| 39 | This is a test workflow without frontmatter.`, |
| 40 | source: "githubnext/agentics/workflows/test.md@main", |
| 41 | expectError: false, |
| 42 | checkSource: true, |
| 43 | }, |
| 44 | { |
| 45 | name: "add_source_to_existing_workflow_with_fields", |
| 46 | content: `--- |
| 47 | description: "Test workflow description" |
| 48 | on: push |
| 49 | permissions: |
| 50 | contents: read |
| 51 | engine: claude |
| 52 | tools: |
| 53 | github: |
| 54 | allowed: [list_commits] |
| 55 | --- |
| 56 | |
| 57 | # Test Workflow |
| 58 | |
| 59 | This is a test workflow.`, |
| 60 | source: "githubnext/agentics/workflows/complex.md@v1.0.0", |
| 61 | expectError: false, |
| 62 | checkSource: true, |
| 63 | }, |
| 64 | { |
| 65 | name: "verify_on_keyword_not_quoted", |
| 66 | content: `--- |
| 67 | on: |
| 68 | push: |
nothing calls this directly
no test coverage detected