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

Function TestRunSnapshot_FileOutput

apps/cli/internal/cli/snapshot_test.go:480–504  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

478}
479
480func TestRunSnapshot_FileOutput(t *testing.T) {
481 tmpDir := createSnapshotTestFiles(t)
482 resetSnapshotFlags()
483
484 outFile := filepath.Join(t.TempDir(), "snapshot.json")
485 snapshotOut = outFile
486
487 _, err := captureSnapshotOutput(t, []string{tmpDir})
488 if err != nil {
489 t.Fatalf("runSnapshot failed: %v", err)
490 }
491
492 data, err := os.ReadFile(outFile)
493 if err != nil {
494 t.Fatalf("failed to read output file: %v", err)
495 }
496
497 var result SnapshotOutput
498 if err := json.Unmarshal(data, &result); err != nil {
499 t.Fatalf("output file is not valid JSON: %v", err)
500 }
501 if len(result.Tasks) != 4 {
502 t.Errorf("expected 4 tasks in file, got %d", len(result.Tasks))
503 }
504}
505
506func TestRunSnapshot_InvalidFormat(t *testing.T) {
507 tmpDir := createSnapshotTestFiles(t)

Callers

nothing calls this directly

Calls 3

createSnapshotTestFilesFunction · 0.85
resetSnapshotFlagsFunction · 0.85
captureSnapshotOutputFunction · 0.85

Tested by

no test coverage detected