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

Function TestTaskCRUD

internal/flowdb/db_test.go:137–158  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

135}
136
137func TestTaskCRUD(t *testing.T) {
138 db := openTempDB(t)
139 insertProject(t, db, "proj", "Proj", "/tmp/proj", "medium")
140 insertTask(t, db, "work", "Some Work", "backlog", "medium", "/tmp/proj", "proj")
141 got, err := GetTask(db, "work")
142 if err != nil {
143 t.Fatalf("GetTask: %v", err)
144 }
145 if got.Slug != "work" || !got.ProjectSlug.Valid || got.ProjectSlug.String != "proj" {
146 t.Errorf("unexpected task: %+v", got)
147 }
148 // Backlog floating task (no project, no session_id — both NULL is
149 // allowed for backlog under the session-id invariant).
150 insertTask(t, db, "float", "Floating", "backlog", "high", "/tmp/float", nil)
151 floating, err := GetTask(db, "float")
152 if err != nil {
153 t.Fatalf("GetTask floating: %v", err)
154 }
155 if floating.ProjectSlug.Valid {
156 t.Errorf("expected null project_slug")
157 }
158}
159
160func TestWorkdirUpsert(t *testing.T) {
161 db := openTempDB(t)

Callers

nothing calls this directly

Calls 4

GetTaskFunction · 0.85
openTempDBFunction · 0.70
insertProjectFunction · 0.70
insertTaskFunction · 0.70

Tested by

no test coverage detected