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

Function TestProjects_InvalidFormat

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

Source from the content-addressed store, hash-verified

295}
296
297func TestProjects_InvalidFormat(t *testing.T) {
298 resetProjectsFlags()
299 projectsFormat = "csv"
300
301 setupGlobalRegistry(t, "projects:\n"+
302 " - id: proj1\n"+
303 " name: \"Test\"\n"+
304 " path: /tmp\n")
305
306 // Create the /tmp path so it passes stat check, but the format error should come first
307 // since collectProjectSummaries runs before format switch — actually format switch is after.
308 // We need a valid project for the format branch to be reached.
309 projectDir := createProjectWithTasks(t, "tasks", map[string]string{
310 "001.md": taskFile("001", "Task", "pending"),
311 })
312 setupGlobalRegistry(t, "projects:\n"+
313 " - id: proj1\n"+
314 " name: \"Test\"\n"+
315 " path: "+projectDir+"\n")
316
317 _, _, err := captureProjectsOutput(t)
318 if err == nil {
319 t.Fatal("expected error for invalid format")
320 }
321 if !strings.Contains(err.Error(), "unsupported format") {
322 t.Errorf("expected 'unsupported format' error, got: %v", err)
323 }
324}
325
326// taskFile is a helper to generate task markdown content.
327func taskFile(id, title, status string) string {

Callers

nothing calls this directly

Calls 6

resetProjectsFlagsFunction · 0.85
setupGlobalRegistryFunction · 0.85
createProjectWithTasksFunction · 0.85
taskFileFunction · 0.85
captureProjectsOutputFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected