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

Function TestRm_DryRun

apps/cli/internal/cli/rm_test.go:106–129  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

104}
105
106func TestRm_DryRun(t *testing.T) {
107 tmpDir := createRmTestFiles(t)
108 resetRmFlags()
109 taskDir = tmpDir
110 rmDryRun = true
111
112 output, err := captureRmOutput(t, []string{"001"})
113 if err != nil {
114 t.Fatalf("unexpected error: %v", err)
115 }
116
117 if !strings.Contains(output, "Dry run") {
118 t.Errorf("expected dry run message, got: %s", output)
119 }
120
121 if !strings.Contains(output, "Delete 1 task") {
122 t.Errorf("expected preview of task, got: %s", output)
123 }
124
125 // File should NOT be deleted
126 if _, err := os.Stat(filepath.Join(tmpDir, "001-setup.md")); err != nil {
127 t.Error("expected file to remain after dry run")
128 }
129}
130
131func TestRm_TaskNotFound(t *testing.T) {
132 tmpDir := createRmTestFiles(t)

Callers

nothing calls this directly

Calls 4

createRmTestFilesFunction · 0.85
resetRmFlagsFunction · 0.85
captureRmOutputFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected