(t *testing.T)
| 361 | } |
| 362 | |
| 363 | func TestRm_WorklogDirKeptIfNotEmpty(t *testing.T) { |
| 364 | tmpDir := t.TempDir() |
| 365 | os.WriteFile(filepath.Join(tmpDir, "001-setup.md"), []byte(rmTaskPending), 0644) |
| 366 | os.WriteFile(filepath.Join(tmpDir, "002-old.md"), []byte(rmTaskCompleted), 0644) |
| 367 | |
| 368 | // Create worklogs for both tasks |
| 369 | wlDir := filepath.Join(tmpDir, ".worklogs") |
| 370 | os.MkdirAll(wlDir, 0755) |
| 371 | os.WriteFile(filepath.Join(wlDir, "001.md"), []byte("## 2026-02-08T10:00:00Z\n\nWork.\n"), 0644) |
| 372 | os.WriteFile(filepath.Join(wlDir, "002.md"), []byte("## 2026-02-08T10:00:00Z\n\nWork.\n"), 0644) |
| 373 | |
| 374 | resetRmFlags() |
| 375 | taskDir = tmpDir |
| 376 | rmForce = true |
| 377 | |
| 378 | _, err := captureRmOutput(t, []string{"001"}) |
| 379 | if err != nil { |
| 380 | t.Fatalf("unexpected error: %v", err) |
| 381 | } |
| 382 | |
| 383 | // 001 worklog gone, but .worklogs dir should remain (002.md still there) |
| 384 | if _, err := os.Stat(filepath.Join(wlDir, "001.md")); !os.IsNotExist(err) { |
| 385 | t.Error("expected 001 worklog to be deleted") |
| 386 | } |
| 387 | if _, err := os.Stat(wlDir); err != nil { |
| 388 | t.Error("expected .worklogs directory to remain (still has 002.md)") |
| 389 | } |
| 390 | } |
| 391 | |
| 392 | func TestRm_ShowsTaskDetails(t *testing.T) { |
| 393 | tmpDir := createRmTestFiles(t) |
nothing calls this directly
no test coverage detected