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

Function TestExport_GraphJSON

apps/cli/internal/web/export_test.go:415–445  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

413}
414
415func TestExport_GraphJSON(t *testing.T) {
416 taskDir := createTestTaskDir(t)
417 outDir := filepath.Join(t.TempDir(), "export")
418
419 err := exportWithMockFS(t, ExportConfig{
420 OutputDir: outDir,
421 ScanDir: taskDir,
422 BasePath: "/",
423 Version: "test",
424 })
425 if err != nil {
426 t.Fatalf("Export failed: %v", err)
427 }
428
429 data, err := os.ReadFile(filepath.Join(outDir, "api", "graph.json"))
430 if err != nil {
431 t.Fatalf("failed to read graph.json: %v", err)
432 }
433
434 var result map[string]any
435 if err := json.Unmarshal(data, &result); err != nil {
436 t.Fatalf("invalid JSON in graph.json: %v", err)
437 }
438
439 if _, ok := result["nodes"]; !ok {
440 t.Error("expected 'nodes' in graph.json")
441 }
442 if _, ok := result["edges"]; !ok {
443 t.Error("expected 'edges' in graph.json")
444 }
445}
446
447func TestExport_StatsJSON(t *testing.T) {
448 taskDir := createTestTaskDir(t)

Callers

nothing calls this directly

Calls 3

createTestTaskDirFunction · 0.85
exportWithMockFSFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected