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

Function TestHandleProjects_NilLoader

apps/cli/internal/web/handlers_test.go:1334–1351  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1332}
1333
1334func TestHandleProjects_NilLoader(t *testing.T) {
1335 req := httptest.NewRequest(http.MethodGet, "/api/projects", nil)
1336 rec := httptest.NewRecorder()
1337
1338 handleProjects(nil)(rec, req)
1339
1340 if rec.Code != http.StatusOK {
1341 t.Fatalf("expected 200, got %d", rec.Code)
1342 }
1343
1344 var result []ProjectEntry
1345 if err := json.Unmarshal(rec.Body.Bytes(), &result); err != nil {
1346 t.Fatalf("invalid JSON: %v", err)
1347 }
1348 if len(result) != 0 {
1349 t.Fatalf("expected empty list, got %d", len(result))
1350 }
1351}
1352
1353func TestHandleTasks_WithProject(t *testing.T) {
1354 defaultDir := createTestTaskDir(t)

Callers

nothing calls this directly

Calls 1

handleProjectsFunction · 0.85

Tested by

no test coverage detected