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

Function TestRunStats_GroupByPhase_JSON

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

Source from the content-addressed store, hash-verified

282}
283
284func TestRunStats_GroupByPhase_JSON(t *testing.T) {
285 tmpDir := createStatsPhaseTestFiles(t)
286 resetStatsFlags()
287 statsFormat = "json"
288 statsGroupBy = "phase"
289
290 output, err := captureStatsOutput(t, []string{tmpDir})
291 if err != nil {
292 t.Fatalf("runStats failed: %v", err)
293 }
294
295 var m metrics.Metrics
296 if err := json.Unmarshal([]byte(output), &m); err != nil {
297 t.Fatalf("failed to parse JSON: %v\noutput: %s", err, output)
298 }
299
300 if m.TasksByPhase["v0.2"] != 2 {
301 t.Errorf("tasks_by_phase[v0.2] = %d, want 2", m.TasksByPhase["v0.2"])
302 }
303 if m.TasksByPhase["v0.3"] != 1 {
304 t.Errorf("tasks_by_phase[v0.3] = %d, want 1", m.TasksByPhase["v0.3"])
305 }
306}
307
308func TestRunStats_InvalidGroupBy(t *testing.T) {
309 tmpDir := createStatsPhaseTestFiles(t)

Callers

nothing calls this directly

Calls 3

resetStatsFlagsFunction · 0.85
captureStatsOutputFunction · 0.85

Tested by

no test coverage detected