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

Function TestRunImport_FetchError

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

Source from the content-addressed store, hash-verified

375}
376
377func 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
404func TestRunImport_EmptyResult(t *testing.T) {
405 sourceName := "test-import-empty"

Callers

nothing calls this directly

Calls 4

cleanupRegistryFunction · 0.85
RegisterFunction · 0.85
RunImportFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected