TestExtractWorkflowDescription tests the ExtractWorkflowDescription function
(t *testing.T)
| 11 | |
| 12 | // TestExtractWorkflowDescription tests the ExtractWorkflowDescription function |
| 13 | func TestExtractWorkflowDescription(t *testing.T) { |
| 14 | tests := []struct { |
| 15 | name string |
| 16 | content string |
| 17 | expected string |
| 18 | }{ |
| 19 | { |
| 20 | name: "workflow with description", |
| 21 | content: `--- |
| 22 | name: Test Workflow |
| 23 | description: This is a test workflow description |
| 24 | on: push |
| 25 | --- |
| 26 | |
| 27 | # Test Workflow |
| 28 | |
| 29 | This is the workflow content.`, |
| 30 | expected: "This is a test workflow description", |
| 31 | }, |
| 32 | { |
| 33 | name: "workflow without description", |
| 34 | content: `--- |
| 35 | name: Test Workflow |
| 36 | on: push |
| 37 | --- |
| 38 | |
| 39 | # Test Workflow |
| 40 | |
| 41 | This is the workflow content.`, |
| 42 | expected: "", |
| 43 | }, |
| 44 | { |
| 45 | name: "workflow with empty description", |
| 46 | content: `--- |
| 47 | name: Test Workflow |
| 48 | description: "" |
| 49 | on: push |
| 50 | --- |
| 51 | |
| 52 | # Test Workflow |
| 53 | |
| 54 | This is the workflow content.`, |
| 55 | expected: "", |
| 56 | }, |
| 57 | { |
| 58 | name: "workflow with multi-line description", |
| 59 | content: `--- |
| 60 | name: Test Workflow |
| 61 | description: | |
| 62 | This is a multi-line |
| 63 | test workflow description |
| 64 | on: push |
| 65 | --- |
| 66 | |
| 67 | # Test Workflow |
| 68 | |
| 69 | This is the workflow content.`, |
| 70 | expected: "This is a multi-line\ntest workflow description\n", |
nothing calls this directly
no test coverage detected