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

Function TestOutputStatsTable_EmptyBreakdowns

apps/cli/internal/cli/stats_test.go:187–219  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

185}
186
187func TestOutputStatsTable_EmptyBreakdowns(t *testing.T) {
188 m := &metrics.Metrics{
189 TotalTasks: 0,
190 TasksByStatus: map[model.Status]int{},
191 TasksByPriority: map[model.Priority]int{},
192 TasksByEffort: map[model.Effort]int{},
193 TasksByType: map[model.TaskType]int{},
194 }
195
196 // Capture output
197 oldStdout := os.Stdout
198 r, w, _ := os.Pipe()
199 os.Stdout = w
200
201 err := outputStatsTable(m, "")
202
203 w.Close()
204 os.Stdout = oldStdout
205
206 var buf bytes.Buffer
207 buf.ReadFrom(r)
208 output := buf.String()
209
210 if err != nil {
211 t.Fatalf("outputStatsTable failed: %v", err)
212 }
213
214 // Each empty breakdown should print "(none)"
215 count := strings.Count(output, "(none)")
216 if count < 3 {
217 t.Errorf("expected at least 3 '(none)' strings (status, priority, effort), got %d\noutput:\n%s", count, output)
218 }
219}
220
221func createStatsPhaseTestFiles(t *testing.T) string {
222 t.Helper()

Callers

nothing calls this directly

Calls 1

outputStatsTableFunction · 0.85

Tested by

no test coverage detected