MCPcopy Create free account
hub / github.com/driangle/taskmd / TestProjects_ValidProjectsTable

Function TestProjects_ValidProjectsTable

apps/cli/internal/cli/projects_test.go:112–144  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

110}
111
112func TestProjects_ValidProjectsTable(t *testing.T) {
113 resetProjectsFlags()
114
115 projectDir := createProjectWithTasks(t, "tasks", map[string]string{
116 "001.md": taskFile("001", "Task A", "pending"),
117 "002.md": taskFile("002", "Task B", "in-progress"),
118 "003.md": taskFile("003", "Task C", "completed"),
119 "004.md": taskFile("004", "Task D", "pending"),
120 })
121
122 setupGlobalRegistry(t, "projects:\n"+
123 " - id: proj1\n"+
124 " name: \"Test Project\"\n"+
125 " path: "+projectDir+"\n")
126
127 stdout, _, err := captureProjectsOutput(t)
128 if err != nil {
129 t.Fatalf("unexpected error: %v", err)
130 }
131
132 for _, expected := range []string{"PROJECT", "PATH", "TASKS", "PENDING", "IN-PROGRESS", "COMPLETED"} {
133 if !strings.Contains(stdout, expected) {
134 t.Errorf("table output missing header %q:\n%s", expected, stdout)
135 }
136 }
137
138 if !strings.Contains(stdout, "Test Project") {
139 t.Errorf("table output missing project name:\n%s", stdout)
140 }
141 if !strings.Contains(stdout, projectDir) {
142 t.Errorf("table output missing project path:\n%s", stdout)
143 }
144}
145
146func TestProjects_JSONOutput(t *testing.T) {
147 resetProjectsFlags()

Callers

nothing calls this directly

Calls 5

resetProjectsFlagsFunction · 0.85
createProjectWithTasksFunction · 0.85
taskFileFunction · 0.85
setupGlobalRegistryFunction · 0.85
captureProjectsOutputFunction · 0.85

Tested by

no test coverage detected