(t *testing.T)
| 13 | ) |
| 14 | |
| 15 | func TestExtractWorkflowNameFromFile(t *testing.T) { |
| 16 | // Create temporary directory for test files |
| 17 | tmpDir := testutil.TempDir(t, "test-*") |
| 18 | |
| 19 | tests := []struct { |
| 20 | name string |
| 21 | content string |
| 22 | filename string |
| 23 | expected string |
| 24 | expectError bool |
| 25 | }{ |
| 26 | { |
| 27 | name: "file with H1 header", |
| 28 | content: `--- |
| 29 | title: Test Workflow |
| 30 | --- |
| 31 | |
| 32 | # Daily Test Coverage Improvement |
| 33 | |
| 34 | This is a test workflow.`, |
| 35 | filename: "test-workflow.md", |
| 36 | expected: "Daily Test Coverage Improvement", |
| 37 | expectError: false, |
| 38 | }, |
| 39 | { |
| 40 | name: "file with H1 header with extra spaces", |
| 41 | content: `# Weekly Research |
| 42 | |
| 43 | This is a research workflow.`, |
| 44 | filename: "weekly-research.md", |
| 45 | expected: "Weekly Research", |
| 46 | expectError: false, |
| 47 | }, |
| 48 | { |
| 49 | name: "file without H1 header - generates from filename", |
| 50 | content: `This is content without H1 header. |
| 51 | |
| 52 | ## Some H2 header |
| 53 | |
| 54 | Content here.`, |
| 55 | filename: "daily-dependency-updates.md", |
| 56 | expected: "Daily Dependency Updates", |
| 57 | expectError: false, |
| 58 | }, |
| 59 | { |
| 60 | name: "file with complex filename", |
| 61 | content: `No headers here.`, |
| 62 | filename: "complex-workflow-name-test.md", |
| 63 | expected: "Complex Workflow Name Test", |
| 64 | expectError: false, |
| 65 | }, |
| 66 | { |
| 67 | name: "file with single word filename", |
| 68 | content: `No headers.`, |
| 69 | filename: "workflow.md", |
| 70 | expected: "Workflow", |
| 71 | expectError: false, |
| 72 | }, |
nothing calls this directly
no test coverage detected