(t *testing.T)
| 375 | } |
| 376 | |
| 377 | func TestRunImport_FetchError(t *testing.T) { |
| 378 | sourceName := "test-import-fetcherr" |
| 379 | defer cleanupRegistry(sourceName) |
| 380 | |
| 381 | Register(&mockSource{ |
| 382 | name: sourceName, |
| 383 | fetchErr: fmt.Errorf("API rate limit exceeded"), |
| 384 | }) |
| 385 | |
| 386 | dir := t.TempDir() |
| 387 | |
| 388 | cfg := ImportConfig{ |
| 389 | SourceName: sourceName, |
| 390 | SourceCfg: SourceConfig{Name: sourceName}, |
| 391 | OutputDir: filepath.Join(dir, "tasks"), |
| 392 | ScanDir: dir, |
| 393 | } |
| 394 | |
| 395 | _, err := RunImport(cfg) |
| 396 | if err == nil { |
| 397 | t.Fatal("expected error when fetch fails") |
| 398 | } |
| 399 | if !strings.Contains(err.Error(), "API rate limit exceeded") { |
| 400 | t.Errorf("expected fetch error message, got: %v", err) |
| 401 | } |
| 402 | } |
| 403 | |
| 404 | func TestRunImport_EmptyResult(t *testing.T) { |
| 405 | sourceName := "test-import-empty" |
nothing calls this directly
no test coverage detected