(t *testing.T)
| 87 | } |
| 88 | |
| 89 | func 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 | |
| 131 | func TestRunImport_DuplicateDetection(t *testing.T) { |
| 132 | sourceName := "test-import-dedup" |
nothing calls this directly
no test coverage detected