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

Function TestCmdAddProjectHappyPath

internal/app/add_test.go:40–80  ·  view source on GitHub ↗

---------- add project ----------

(t *testing.T)

Source from the content-addressed store, hash-verified

38// ---------- add project ----------
39
40func TestCmdAddProjectHappyPath(t *testing.T) {
41 root := setupFlowRoot(t)
42 wd := t.TempDir()
43
44 rc := cmdAdd([]string{"project", "Auth Service", "--work-dir", wd, "--priority", "high"})
45 if rc != 0 {
46 t.Fatalf("rc=%d", rc)
47 }
48
49 db := openFlowDB(t)
50 p, err := flowdb.GetProject(db, "auth-service")
51 if err != nil {
52 t.Fatalf("GetProject: %v", err)
53 }
54 if p.Name != "Auth Service" {
55 t.Errorf("name: got %q", p.Name)
56 }
57 if p.Priority != "high" {
58 t.Errorf("priority: got %q", p.Priority)
59 }
60 if p.WorkDir != wd {
61 t.Errorf("work_dir: got %q, want %q", p.WorkDir, wd)
62 }
63 if p.Status != "active" {
64 t.Errorf("status: got %q", p.Status)
65 }
66
67 // brief.md and updates/ dirs should exist.
68 briefPath := filepath.Join(root, "projects", "auth-service", "brief.md")
69 if _, err := os.Stat(briefPath); err != nil {
70 t.Errorf("brief.md missing: %v", err)
71 }
72 if _, err := os.Stat(filepath.Join(root, "projects", "auth-service", "updates")); err != nil {
73 t.Errorf("updates/ dir missing: %v", err)
74 }
75
76 // workdir auto-registered.
77 if _, err := flowdb.GetWorkdir(db, wd); err != nil {
78 t.Errorf("workdir not auto-registered: %v", err)
79 }
80}
81
82func TestCmdAddProjectRequiresWorkDir(t *testing.T) {
83 setupFlowRoot(t)

Callers

nothing calls this directly

Calls 5

GetProjectFunction · 0.92
GetWorkdirFunction · 0.92
setupFlowRootFunction · 0.85
cmdAddFunction · 0.85
openFlowDBFunction · 0.85

Tested by

no test coverage detected