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

Function TestRunImport_DryRun

apps/cli/internal/sync/import_engine_test.go:89–129  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

87}
88
89func TestRunImport_DryRun(t *testing.T) {
90 sourceName := "test-import-dryrun"
91 defer cleanupRegistry(sourceName)
92
93 setupMockSource(sourceName, []ExternalTask{
94 {ExternalID: "EXT-1", Title: "A task", Status: "open"},
95 })
96
97 dir := t.TempDir()
98 outputDir := filepath.Join(dir, "tasks")
99
100 cfg := ImportConfig{
101 SourceName: sourceName,
102 SourceCfg: SourceConfig{Name: sourceName},
103 OutputDir: outputDir,
104 ScanDir: dir,
105 DryRun: true,
106 }
107
108 result, err := RunImport(cfg)
109 if err != nil {
110 t.Fatalf("unexpected error: %v", err)
111 }
112
113 if len(result.Created) != 1 {
114 t.Errorf("expected 1 created, got %d", len(result.Created))
115 }
116
117 // Verify no files were written
118 if _, err := os.Stat(outputDir); !os.IsNotExist(err) {
119 t.Error("expected output directory to not exist in dry-run mode")
120 }
121
122 // Verify action still has metadata
123 if result.Created[0].FilePath != "" {
124 t.Errorf("expected empty file path in dry-run, got %s", result.Created[0].FilePath)
125 }
126 if result.Created[0].LocalID == "" {
127 t.Error("expected local ID to be assigned even in dry-run")
128 }
129}
130
131func TestRunImport_DuplicateDetection(t *testing.T) {
132 sourceName := "test-import-dedup"

Callers

nothing calls this directly

Calls 4

cleanupRegistryFunction · 0.85
setupMockSourceFunction · 0.85
RunImportFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected