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

Function TestHandleGraph

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

Source from the content-addressed store, hash-verified

322}
323
324func TestHandleGraph(t *testing.T) {
325 dir := createTestTaskDir(t)
326 dp := NewDataProvider(dir, false)
327
328 req := httptest.NewRequest(http.MethodGet, "/api/graph", nil)
329 rec := httptest.NewRecorder()
330
331 handleGraph(dp)(rec, req)
332
333 if rec.Code != http.StatusOK {
334 t.Fatalf("expected 200, got %d", rec.Code)
335 }
336
337 var result map[string]any
338 if err := json.Unmarshal(rec.Body.Bytes(), &result); err != nil {
339 t.Fatalf("invalid JSON: %v", err)
340 }
341
342 if _, ok := result["nodes"]; !ok {
343 t.Fatal("expected 'nodes' in graph response")
344 }
345 if _, ok := result["edges"]; !ok {
346 t.Fatal("expected 'edges' in graph response")
347 }
348}
349
350func TestHandleGraphMermaid(t *testing.T) {
351 dir := createTestTaskDir(t)

Callers

nothing calls this directly

Calls 3

createTestTaskDirFunction · 0.85
NewDataProviderFunction · 0.85
handleGraphFunction · 0.70

Tested by

no test coverage detected