(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestExtractWorkflowDependencies(t *testing.T) { |
| 12 | frontmatter := map[string]any{ |
| 13 | "imports": []any{ |
| 14 | "shared/base.md#section", |
| 15 | map[string]any{"uses": "owner/repo/.github/workflows/common.md@main"}, |
| 16 | }, |
| 17 | } |
| 18 | content := ` |
| 19 | @include local/helpers.md#part |
| 20 | @import shared/base.md |
| 21 | ` |
| 22 | |
| 23 | got := extractWorkflowDependencies(content, frontmatter) |
| 24 | want := []string{ |
| 25 | "local/helpers.md", |
| 26 | "owner/repo/.github/workflows/common.md@main", |
| 27 | "shared/base.md", |
| 28 | } |
| 29 | |
| 30 | assert.Len(t, got, len(want), "dependency count should match expected unique set") |
| 31 | for i := range want { |
| 32 | assert.Equal(t, want[i], got[i], "dependency should match normalized and sorted value") |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | func TestExtractWorkflowDependencies_ImportsObjectAW(t *testing.T) { |
| 37 | frontmatter := map[string]any{ |
nothing calls this directly
no test coverage detected