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

Function TestRm_InteractiveConfirmNo

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

Source from the content-addressed store, hash-verified

169}
170
171func TestRm_InteractiveConfirmNo(t *testing.T) {
172 tmpDir := createRmTestFiles(t)
173 resetRmFlags()
174 taskDir = tmpDir
175
176 // Simulate user typing "n"
177 oldStdin := rmStdinReader
178 rmStdinReader = strings.NewReader("n\n")
179 defer func() { rmStdinReader = oldStdin }()
180
181 output, err := captureRmOutput(t, []string{"001"})
182 if err != nil {
183 t.Fatalf("unexpected error: %v", err)
184 }
185
186 if !strings.Contains(output, "Cancelled") {
187 t.Errorf("expected cancellation message, got: %s", output)
188 }
189
190 // File should remain
191 if _, err := os.Stat(filepath.Join(tmpDir, "001-setup.md")); err != nil {
192 t.Error("expected file to remain after declining")
193 }
194}
195
196func TestRm_InteractiveConfirmEmpty(t *testing.T) {
197 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