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

Function TestCmdEditProjectOnlyByDefault

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

Source from the content-addressed store, hash-verified

209}
210
211func TestCmdEditProjectOnlyByDefault(t *testing.T) {
212 root, db := showListEditDB(t)
213 insertProject(t, db, "soloProj", "S", filepath.Join(root, "x"), "medium")
214 briefPath := filepath.Join(root, "projects", "soloProj", "brief.md")
215 if err := os.MkdirAll(filepath.Dir(briefPath), 0o755); err != nil {
216 t.Fatal(err)
217 }
218 if err := os.WriteFile(briefPath, []byte("."), 0o644); err != nil {
219 t.Fatal(err)
220 }
221 script := writeFakeEditor(t, t.TempDir())
222 os.Setenv("EDITOR", script)
223 t.Cleanup(func() { os.Unsetenv("EDITOR") })
224
225 out := captureStdout(t, func() {
226 if rc := cmdEdit([]string{"soloProj"}); rc != 0 {
227 t.Errorf("rc=%d", rc)
228 }
229 })
230 if !strings.Contains(out, "Edited project soloProj") {
231 t.Errorf("out=%q", out)
232 }
233}
234
235func TestCmdEditPlaybook(t *testing.T) {
236 root := setupFlowRoot(t)

Callers

nothing calls this directly

Calls 5

showListEditDBFunction · 0.85
writeFakeEditorFunction · 0.85
captureStdoutFunction · 0.85
cmdEditFunction · 0.85
insertProjectFunction · 0.70

Tested by

no test coverage detected