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

Function TestImportCommand_DryRun

apps/cli/internal/cli/importcmd_test.go:71–104  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

69}
70
71func TestImportCommand_DryRun(t *testing.T) {
72 sourceName := "test-import-cli-dry"
73 defer sync.Unregister(sourceName)
74
75 sync.Register(&cliMockSource{
76 name: sourceName,
77 tasks: []sync.ExternalTask{
78 {ExternalID: "DRY-1", Title: "Dry run task", Status: "open"},
79 },
80 })
81
82 tmpDir := t.TempDir()
83 origDir, _ := os.Getwd()
84 if err := os.Chdir(tmpDir); err != nil {
85 t.Fatal(err)
86 }
87 defer os.Chdir(origDir)
88
89 resetImportFlags()
90 importSource = sourceName
91 importOutDir = filepath.Join(tmpDir, "tasks")
92 importDryRun = true
93
94 err := runImport(importCmd, nil)
95 if err != nil {
96 t.Fatalf("unexpected error: %v", err)
97 }
98
99 // No files should be created
100 _, statErr := os.Stat(filepath.Join(tmpDir, "tasks"))
101 if statErr == nil {
102 t.Error("expected no tasks directory in dry-run mode")
103 }
104}
105
106func TestImportCommand_JSONOutput(t *testing.T) {
107 sourceName := "test-import-cli-json"

Callers

nothing calls this directly

Calls 3

resetImportFlagsFunction · 0.85
runImportFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected