(t *testing.T)
| 322 | } |
| 323 | |
| 324 | func 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 | |
| 350 | func TestHandleGraphMermaid(t *testing.T) { |
| 351 | dir := createTestTaskDir(t) |
nothing calls this directly
no test coverage detected