(t *testing.T)
| 180 | } |
| 181 | |
| 182 | func TestRunImport_SequentialIDs(t *testing.T) { |
| 183 | sourceName := "test-import-seq" |
| 184 | defer cleanupRegistry(sourceName) |
| 185 | |
| 186 | setupMockSource(sourceName, []ExternalTask{ |
| 187 | {ExternalID: "EXT-1", Title: "First", Status: "open"}, |
| 188 | {ExternalID: "EXT-2", Title: "Second", Status: "open"}, |
| 189 | {ExternalID: "EXT-3", Title: "Third", Status: "open"}, |
| 190 | }) |
| 191 | |
| 192 | dir := t.TempDir() |
| 193 | outputDir := filepath.Join(dir, "tasks") |
| 194 | |
| 195 | cfg := ImportConfig{ |
| 196 | SourceName: sourceName, |
| 197 | SourceCfg: SourceConfig{Name: sourceName}, |
| 198 | OutputDir: outputDir, |
| 199 | ScanDir: dir, |
| 200 | } |
| 201 | |
| 202 | result, err := RunImport(cfg) |
| 203 | if err != nil { |
| 204 | t.Fatalf("unexpected error: %v", err) |
| 205 | } |
| 206 | |
| 207 | if len(result.Created) != 3 { |
| 208 | t.Fatalf("expected 3 created, got %d", len(result.Created)) |
| 209 | } |
| 210 | |
| 211 | // IDs should be sequential |
| 212 | ids := make(map[string]bool) |
| 213 | for _, a := range result.Created { |
| 214 | ids[a.LocalID] = true |
| 215 | } |
| 216 | if len(ids) != 3 { |
| 217 | t.Errorf("expected 3 unique IDs, got %d", len(ids)) |
| 218 | } |
| 219 | |
| 220 | // Check sequential order |
| 221 | if result.Created[0].LocalID != "001" { |
| 222 | t.Errorf("expected first ID to be 001, got %s", result.Created[0].LocalID) |
| 223 | } |
| 224 | if result.Created[1].LocalID != "002" { |
| 225 | t.Errorf("expected second ID to be 002, got %s", result.Created[1].LocalID) |
| 226 | } |
| 227 | if result.Created[2].LocalID != "003" { |
| 228 | t.Errorf("expected third ID to be 003, got %s", result.Created[2].LocalID) |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | func TestRunImport_IDsRespectExisting(t *testing.T) { |
| 233 | sourceName := "test-import-existing-ids" |
nothing calls this directly
no test coverage detected