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

Function TestCmdAddTaskFloating

internal/app/add_test.go:142–171  ·  view source on GitHub ↗

---------- add task ----------

(t *testing.T)

Source from the content-addressed store, hash-verified

140// ---------- add task ----------
141
142func TestCmdAddTaskFloating(t *testing.T) {
143 root := setupFlowRoot(t)
144
145 rc := cmdAdd([]string{"task", "Fix bug"})
146 if rc != 0 {
147 t.Fatalf("rc=%d", rc)
148 }
149 db := openFlowDB(t)
150 task, err := flowdb.GetTask(db, "fix-bug")
151 if err != nil {
152 t.Fatalf("GetTask: %v", err)
153 }
154 if task.ProjectSlug.Valid {
155 t.Errorf("expected floating task, got project %q", task.ProjectSlug.String)
156 }
157 expectedWorkDir := filepath.Join(root, "tasks", "fix-bug", "workspace")
158 if task.WorkDir != expectedWorkDir {
159 t.Errorf("work_dir: got %q, want %q", task.WorkDir, expectedWorkDir)
160 }
161 if _, err := os.Stat(expectedWorkDir); err != nil {
162 t.Errorf("workspace dir not created: %v", err)
163 }
164 // brief.md and updates/ present.
165 if _, err := os.Stat(filepath.Join(root, "tasks", "fix-bug", "brief.md")); err != nil {
166 t.Errorf("brief.md missing: %v", err)
167 }
168 if _, err := os.Stat(filepath.Join(root, "tasks", "fix-bug", "updates")); err != nil {
169 t.Errorf("updates/ missing: %v", err)
170 }
171}
172
173func TestCmdAddTaskInheritsProjectWorkDir(t *testing.T) {
174 setupFlowRoot(t)

Callers

nothing calls this directly

Calls 4

GetTaskFunction · 0.92
setupFlowRootFunction · 0.85
cmdAddFunction · 0.85
openFlowDBFunction · 0.85

Tested by

no test coverage detected