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

Function TestExport_TaskDetailJSON

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

Source from the content-addressed store, hash-verified

123}
124
125func TestExport_TaskDetailJSON(t *testing.T) {
126 taskDir := createTestTaskDir(t)
127 outDir := filepath.Join(t.TempDir(), "export")
128
129 err := exportWithMockFS(t, ExportConfig{
130 OutputDir: outDir,
131 ScanDir: taskDir,
132 BasePath: "/",
133 Version: "test",
134 })
135 if err != nil {
136 t.Fatalf("Export failed: %v", err)
137 }
138
139 data, err := os.ReadFile(filepath.Join(outDir, "api", "tasks", "001.json"))
140 if err != nil {
141 t.Fatalf("failed to read task detail: %v", err)
142 }
143
144 var detail map[string]any
145 if err := json.Unmarshal(data, &detail); err != nil {
146 t.Fatalf("invalid JSON in task detail: %v", err)
147 }
148
149 if detail["id"] != "001" {
150 t.Errorf("expected id '001', got %v", detail["id"])
151 }
152
153 if _, ok := detail["body"]; !ok {
154 t.Error("expected body field in task detail")
155 }
156}
157
158func TestExport_BoardJSON(t *testing.T) {
159 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