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

Function TestExport_StatsJSON

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

Source from the content-addressed store, hash-verified

445}
446
447func TestExport_StatsJSON(t *testing.T) {
448 taskDir := createTestTaskDir(t)
449 outDir := filepath.Join(t.TempDir(), "export")
450
451 err := exportWithMockFS(t, ExportConfig{
452 OutputDir: outDir,
453 ScanDir: taskDir,
454 BasePath: "/",
455 Version: "test",
456 })
457 if err != nil {
458 t.Fatalf("Export failed: %v", err)
459 }
460
461 data, err := os.ReadFile(filepath.Join(outDir, "api", "stats.json"))
462 if err != nil {
463 t.Fatalf("failed to read stats.json: %v", err)
464 }
465
466 var result map[string]any
467 if err := json.Unmarshal(data, &result); err != nil {
468 t.Fatalf("invalid JSON in stats.json: %v", err)
469 }
470
471 totalTasks, ok := result["total_tasks"].(float64)
472 if !ok {
473 t.Fatal("expected total_tasks in stats.json")
474 }
475 if int(totalTasks) != 2 {
476 t.Errorf("expected 2 total tasks, got %d", int(totalTasks))
477 }
478}
479
480func TestPatchIndexHTML_RelativePaths(t *testing.T) {
481 input := `<head><script src="/assets/app.js"></script></head>`

Callers

nothing calls this directly

Calls 2

createTestTaskDirFunction · 0.85
exportWithMockFSFunction · 0.85

Tested by

no test coverage detected