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

Function TestImportCommand_OutputDirFlag

apps/cli/internal/cli/importcmd_test.go:275–311  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

273}
274
275func TestImportCommand_OutputDirFlag(t *testing.T) {
276 sourceName := "test-import-cli-outdir"
277 defer sync.Unregister(sourceName)
278
279 sync.Register(&cliMockSource{
280 name: sourceName,
281 tasks: []sync.ExternalTask{
282 {ExternalID: "DIR-1", Title: "Custom dir task", Status: "open"},
283 },
284 })
285
286 tmpDir := t.TempDir()
287 origDir, _ := os.Getwd()
288 if err := os.Chdir(tmpDir); err != nil {
289 t.Fatal(err)
290 }
291 defer os.Chdir(origDir)
292
293 customDir := filepath.Join(tmpDir, "custom", "output")
294
295 resetImportFlags()
296 importSource = sourceName
297 importOutDir = customDir
298
299 err := runImport(importCmd, nil)
300 if err != nil {
301 t.Fatalf("unexpected error: %v", err)
302 }
303
304 entries, err := os.ReadDir(customDir)
305 if err != nil {
306 t.Fatalf("failed to read custom dir: %v", err)
307 }
308 if len(entries) != 1 {
309 t.Errorf("expected 1 task file in custom dir, got %d", len(entries))
310 }
311}
312
313func TestImportCommand_FilterFlagPopulatesConfig(t *testing.T) {
314 sourceName := "test-import-cli-filter-cfg"

Callers

nothing calls this directly

Calls 2

resetImportFlagsFunction · 0.85
runImportFunction · 0.85

Tested by

no test coverage detected