MCPcopy Create free account
hub / github.com/driangle/taskmd / createStatsTestFiles

Function createStatsTestFiles

apps/cli/internal/cli/stats_test.go:22–75  ·  view source on GitHub ↗

createStatsTestFiles creates test task files with varying status/priority/effort.

(t *testing.T)

Source from the content-addressed store, hash-verified

20
21// createStatsTestFiles creates test task files with varying status/priority/effort.
22func createStatsTestFiles(t *testing.T) string {
23 t.Helper()
24 tmpDir := t.TempDir()
25
26 tasks := map[string]string{
27 "001-pending-high.md": `---
28id: "001"
29title: "High Priority Pending"
30status: pending
31priority: high
32effort: small
33dependencies: []
34tags: ["api"]
35created: 2026-02-08
36---
37
38Pending high-priority task.
39`,
40 "002-completed-medium.md": `---
41id: "002"
42title: "Completed Medium"
43status: completed
44priority: medium
45effort: medium
46dependencies: []
47tags: ["api"]
48created: 2026-02-08
49---
50
51Completed medium-priority task.
52`,
53 "003-pending-low.md": `---
54id: "003"
55title: "Pending Low with Dep"
56status: pending
57priority: low
58effort: large
59dependencies: ["002"]
60tags: ["frontend"]
61created: 2026-02-08
62---
63
64Pending 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.
78func captureStatsOutput(t *testing.T, args []string) (string, error) {

Callers 4

TestRunStats_JSONOutputFunction · 0.85
TestRunStats_YAMLOutputFunction · 0.85
TestRunStats_TableOutputFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected