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

Function TestExport_ConfigJSON

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

Source from the content-addressed store, hash-verified

186}
187
188func TestExport_ConfigJSON(t *testing.T) {
189 taskDir := createTestTaskDir(t)
190 outDir := filepath.Join(t.TempDir(), "export")
191
192 err := exportWithMockFS(t, ExportConfig{
193 OutputDir: outDir,
194 ScanDir: taskDir,
195 BasePath: "/",
196 Version: "test-1.0.0",
197 })
198 if err != nil {
199 t.Fatalf("Export failed: %v", err)
200 }
201
202 data, err := os.ReadFile(filepath.Join(outDir, "api", "config.json"))
203 if err != nil {
204 t.Fatalf("failed to read config.json: %v", err)
205 }
206
207 var config ConfigResponse
208 if err := json.Unmarshal(data, &config); err != nil {
209 t.Fatalf("invalid JSON in config.json: %v", err)
210 }
211
212 if !config.ReadOnly {
213 t.Error("expected readonly to be true in exported config")
214 }
215
216 if config.Version != "test-1.0.0" {
217 t.Errorf("expected version 'test-1.0.0', got %q", config.Version)
218 }
219}
220
221func TestExport_IndexHTML_FetchInterceptor(t *testing.T) {
222 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