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

Function TestRm_InteractiveConfirmEmpty

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

Source from the content-addressed store, hash-verified

194}
195
196func TestRm_InteractiveConfirmEmpty(t *testing.T) {
197 tmpDir := createRmTestFiles(t)
198 resetRmFlags()
199 taskDir = tmpDir
200
201 // Simulate user pressing Enter (empty input = default No)
202 oldStdin := rmStdinReader
203 rmStdinReader = strings.NewReader("\n")
204 defer func() { rmStdinReader = oldStdin }()
205
206 output, err := captureRmOutput(t, []string{"001"})
207 if err != nil {
208 t.Fatalf("unexpected error: %v", err)
209 }
210
211 if !strings.Contains(output, "Cancelled") {
212 t.Errorf("expected cancellation message, got: %s", output)
213 }
214
215 // File should remain
216 if _, err := os.Stat(filepath.Join(tmpDir, "001-setup.md")); err != nil {
217 t.Error("expected file to remain after empty input")
218 }
219}
220
221func TestRm_BlockedByDependency(t *testing.T) {
222 tmpDir := t.TempDir()

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