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

Function TestExport_TasksJSON

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

Source from the content-addressed store, hash-verified

94}
95
96func TestExport_TasksJSON(t *testing.T) {
97 taskDir := createTestTaskDir(t)
98 outDir := filepath.Join(t.TempDir(), "export")
99
100 err := exportWithMockFS(t, ExportConfig{
101 OutputDir: outDir,
102 ScanDir: taskDir,
103 BasePath: "/",
104 Version: "test",
105 })
106 if err != nil {
107 t.Fatalf("Export failed: %v", err)
108 }
109
110 data, err := os.ReadFile(filepath.Join(outDir, "api", "tasks.json"))
111 if err != nil {
112 t.Fatalf("failed to read tasks.json: %v", err)
113 }
114
115 var tasks []map[string]any
116 if err := json.Unmarshal(data, &tasks); err != nil {
117 t.Fatalf("invalid JSON in tasks.json: %v", err)
118 }
119
120 if len(tasks) != 2 {
121 t.Fatalf("expected 2 tasks, got %d", len(tasks))
122 }
123}
124
125func TestExport_TaskDetailJSON(t *testing.T) {
126 taskDir := createTestTaskDir(t)

Callers

nothing calls this directly

Calls 2

createTestTaskDirFunction · 0.85
exportWithMockFSFunction · 0.85

Tested by

no test coverage detected