(t *testing.T)
| 69 | } |
| 70 | |
| 71 | func TestImportCommand_DryRun(t *testing.T) { |
| 72 | sourceName := "test-import-cli-dry" |
| 73 | defer sync.Unregister(sourceName) |
| 74 | |
| 75 | sync.Register(&cliMockSource{ |
| 76 | name: sourceName, |
| 77 | tasks: []sync.ExternalTask{ |
| 78 | {ExternalID: "DRY-1", Title: "Dry run task", Status: "open"}, |
| 79 | }, |
| 80 | }) |
| 81 | |
| 82 | tmpDir := t.TempDir() |
| 83 | origDir, _ := os.Getwd() |
| 84 | if err := os.Chdir(tmpDir); err != nil { |
| 85 | t.Fatal(err) |
| 86 | } |
| 87 | defer os.Chdir(origDir) |
| 88 | |
| 89 | resetImportFlags() |
| 90 | importSource = sourceName |
| 91 | importOutDir = filepath.Join(tmpDir, "tasks") |
| 92 | importDryRun = true |
| 93 | |
| 94 | err := runImport(importCmd, nil) |
| 95 | if err != nil { |
| 96 | t.Fatalf("unexpected error: %v", err) |
| 97 | } |
| 98 | |
| 99 | // No files should be created |
| 100 | _, statErr := os.Stat(filepath.Join(tmpDir, "tasks")) |
| 101 | if statErr == nil { |
| 102 | t.Error("expected no tasks directory in dry-run mode") |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | func TestImportCommand_JSONOutput(t *testing.T) { |
| 107 | sourceName := "test-import-cli-json" |
nothing calls this directly
no test coverage detected