(t *testing.T)
| 131 | } |
| 132 | |
| 133 | func TestBuildStatsPlaybookRuns(t *testing.T) { |
| 134 | root := t.TempDir() |
| 135 | claudeProj := t.TempDir() |
| 136 | |
| 137 | db, err := flowdb.OpenDB(filepath.Join(root, "flow.db")) |
| 138 | if err != nil { |
| 139 | t.Fatal(err) |
| 140 | } |
| 141 | defer db.Close() |
| 142 | mustExec(t, db, `INSERT INTO tasks (slug,name,status,kind,work_dir,session_id,created_at,updated_at) |
| 143 | VALUES ('pr1','PR1','done','playbook_run','/work/app', '00000000-0000-4000-8000-000000000002', '2026-06-01T00:00:00Z','2026-06-01T00:00:00Z')`) |
| 144 | |
| 145 | c := LoadCache(filepath.Join(root, "stats-cache.json")) |
| 146 | s, err := BuildStats(BuildOpts{ |
| 147 | Root: root, ClaudeProjects: claudeProj, DB: db, Cache: c, |
| 148 | Constants: DefaultConstants(), Since: time.Time{}, Project: "", |
| 149 | }) |
| 150 | if err != nil { |
| 151 | t.Fatal(err) |
| 152 | } |
| 153 | if s.PlaybookRuns != 1 { |
| 154 | t.Errorf("PlaybookRuns = %d, want 1", s.PlaybookRuns) |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | func TestParseSince(t *testing.T) { |
| 159 | now := time.Date(2026, 6, 17, 0, 0, 0, 0, time.UTC) |
nothing calls this directly
no test coverage detected