(t *testing.T)
| 93 | } |
| 94 | |
| 95 | func TestRunStats_JSONOutput(t *testing.T) { |
| 96 | tmpDir := createStatsTestFiles(t) |
| 97 | resetStatsFlags() |
| 98 | statsFormat = "json" |
| 99 | |
| 100 | output, err := captureStatsOutput(t, []string{tmpDir}) |
| 101 | if err != nil { |
| 102 | t.Fatalf("runStats failed: %v", err) |
| 103 | } |
| 104 | |
| 105 | var m metrics.Metrics |
| 106 | if err := json.Unmarshal([]byte(output), &m); err != nil { |
| 107 | t.Fatalf("failed to parse JSON: %v\noutput: %s", err, output) |
| 108 | } |
| 109 | |
| 110 | if m.TotalTasks != 3 { |
| 111 | t.Errorf("total_tasks = %d, want 3", m.TotalTasks) |
| 112 | } |
| 113 | if m.TasksByStatus[model.StatusPending] != 2 { |
| 114 | t.Errorf("tasks_by_status[pending] = %d, want 2", m.TasksByStatus[model.StatusPending]) |
| 115 | } |
| 116 | if m.TasksByStatus[model.StatusCompleted] != 1 { |
| 117 | t.Errorf("tasks_by_status[completed] = %d, want 1", m.TasksByStatus[model.StatusCompleted]) |
| 118 | } |
| 119 | } |
| 120 | |
| 121 | func TestRunStats_YAMLOutput(t *testing.T) { |
| 122 | tmpDir := createStatsTestFiles(t) |
nothing calls this directly
no test coverage detected