MCPcopy Create free account
hub / github.com/Facets-cloud/flow / TestBuildStatsPlaybookRuns

Function TestBuildStatsPlaybookRuns

internal/stats/report_test.go:133–156  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

131}
132
133func 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
158func TestParseSince(t *testing.T) {
159 now := time.Date(2026, 6, 17, 0, 0, 0, 0, time.UTC)

Callers

nothing calls this directly

Calls 5

OpenDBFunction · 0.92
mustExecFunction · 0.85
LoadCacheFunction · 0.85
BuildStatsFunction · 0.85
DefaultConstantsFunction · 0.85

Tested by

no test coverage detected