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

Function TestCmdEditTaskOnlyByDefault

internal/app/edit_test.go:186–209  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

184}
185
186func TestCmdEditTaskOnlyByDefault(t *testing.T) {
187 // When only a task exists, fuzzy ref resolves without prefix.
188 root, db := showListEditDB(t)
189 insertTask(t, db, "soloTask", "S", "backlog", "medium", filepath.Join(root, "x"), nil)
190 briefPath := filepath.Join(root, "tasks", "soloTask", "brief.md")
191 if err := os.MkdirAll(filepath.Dir(briefPath), 0o755); err != nil {
192 t.Fatal(err)
193 }
194 if err := os.WriteFile(briefPath, []byte("."), 0o644); err != nil {
195 t.Fatal(err)
196 }
197 script := writeFakeEditor(t, t.TempDir())
198 os.Setenv("EDITOR", script)
199 t.Cleanup(func() { os.Unsetenv("EDITOR") })
200
201 out := captureStdout(t, func() {
202 if rc := cmdEdit([]string{"soloTask"}); rc != 0 {
203 t.Errorf("rc=%d", rc)
204 }
205 })
206 if !strings.Contains(out, "Edited task soloTask") {
207 t.Errorf("out=%q", out)
208 }
209}
210
211func TestCmdEditProjectOnlyByDefault(t *testing.T) {
212 root, db := showListEditDB(t)

Callers

nothing calls this directly

Calls 5

showListEditDBFunction · 0.85
writeFakeEditorFunction · 0.85
captureStdoutFunction · 0.85
cmdEditFunction · 0.85
insertTaskFunction · 0.70

Tested by

no test coverage detected