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

Function TestExport_SPARouteFiles

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

Source from the content-addressed store, hash-verified

308}
309
310func TestExport_SPARouteFiles(t *testing.T) {
311 taskDir := createTestTaskDir(t)
312 outDir := filepath.Join(t.TempDir(), "export")
313
314 err := exportWithMockFS(t, ExportConfig{
315 OutputDir: outDir,
316 ScanDir: taskDir,
317 BasePath: "/",
318 Version: "test",
319 })
320 if err != nil {
321 t.Fatalf("Export failed: %v", err)
322 }
323
324 // Top-level SPA routes
325 routes := []string{"tasks", "board", "graph", "next", "stats", "validate", "tracks"}
326 for _, route := range routes {
327 path := filepath.Join(outDir, route, "index.html")
328 if _, err := os.Stat(path); err != nil {
329 t.Errorf("expected SPA fallback at %s/index.html: %v", route, err)
330 }
331 }
332
333 // Per-task routes
334 for _, id := range []string{"001", "002"} {
335 path := filepath.Join(outDir, "tasks", id, "index.html")
336 if _, err := os.Stat(path); err != nil {
337 t.Errorf("expected task route at tasks/%s/index.html: %v", id, err)
338 }
339 }
340
341 // 404.html
342 if _, err := os.Stat(filepath.Join(outDir, "404.html")); err != nil {
343 t.Error("expected 404.html to exist")
344 }
345}
346
347func TestExport_NoEmbeddedAssets(t *testing.T) {
348 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