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

Function TestProjects_UnreachablePath

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

Source from the content-addressed store, hash-verified

194}
195
196func TestProjects_UnreachablePath(t *testing.T) {
197 resetProjectsFlags()
198
199 // Create one valid project
200 projectDir := createProjectWithTasks(t, "tasks", map[string]string{
201 "001.md": taskFile("001", "Task A", "pending"),
202 })
203
204 setupGlobalRegistry(t, "projects:\n"+
205 " - id: missing\n"+
206 " name: \"Missing Project\"\n"+
207 " path: /nonexistent/path/that/does/not/exist\n"+
208 " - id: valid\n"+
209 " name: \"Valid Project\"\n"+
210 " path: "+projectDir+"\n")
211
212 stdout, stderr, err := captureProjectsOutput(t)
213 if err != nil {
214 t.Fatalf("unexpected error: %v", err)
215 }
216
217 if !strings.Contains(stderr, "Warning") {
218 t.Errorf("expected warning for missing project, got stderr:\n%s", stderr)
219 }
220 if !strings.Contains(stderr, "Missing Project") {
221 t.Errorf("expected warning to mention 'Missing Project', got stderr:\n%s", stderr)
222 }
223
224 // Valid project should still appear
225 if !strings.Contains(stdout, "Valid Project") {
226 t.Errorf("expected valid project in output, got:\n%s", stdout)
227 }
228}
229
230func TestProjects_YAMLOutput(t *testing.T) {
231 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