createStatsTestFiles creates test task files with varying status/priority/effort.
(t *testing.T)
| 20 | |
| 21 | // createStatsTestFiles creates test task files with varying status/priority/effort. |
| 22 | func createStatsTestFiles(t *testing.T) string { |
| 23 | t.Helper() |
| 24 | tmpDir := t.TempDir() |
| 25 | |
| 26 | tasks := map[string]string{ |
| 27 | "001-pending-high.md": `--- |
| 28 | id: "001" |
| 29 | title: "High Priority Pending" |
| 30 | status: pending |
| 31 | priority: high |
| 32 | effort: small |
| 33 | dependencies: [] |
| 34 | tags: ["api"] |
| 35 | created: 2026-02-08 |
| 36 | --- |
| 37 | |
| 38 | Pending high-priority task. |
| 39 | `, |
| 40 | "002-completed-medium.md": `--- |
| 41 | id: "002" |
| 42 | title: "Completed Medium" |
| 43 | status: completed |
| 44 | priority: medium |
| 45 | effort: medium |
| 46 | dependencies: [] |
| 47 | tags: ["api"] |
| 48 | created: 2026-02-08 |
| 49 | --- |
| 50 | |
| 51 | Completed medium-priority task. |
| 52 | `, |
| 53 | "003-pending-low.md": `--- |
| 54 | id: "003" |
| 55 | title: "Pending Low with Dep" |
| 56 | status: pending |
| 57 | priority: low |
| 58 | effort: large |
| 59 | dependencies: ["002"] |
| 60 | tags: ["frontend"] |
| 61 | created: 2026-02-08 |
| 62 | --- |
| 63 | |
| 64 | Pending task with dependency. |
| 65 | `, |
| 66 | } |
| 67 | |
| 68 | for filename, content := range tasks { |
| 69 | if err := os.WriteFile(filepath.Join(tmpDir, filename), []byte(content), 0644); err != nil { |
| 70 | t.Fatalf("failed to create test file %s: %v", filename, err) |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | return tmpDir |
| 75 | } |
| 76 | |
| 77 | // captureStatsOutput runs the stats command and captures stdout. |
| 78 | func captureStatsOutput(t *testing.T, args []string) (string, error) { |
no outgoing calls
no test coverage detected