aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/test-pearl-delete.el16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test-pearl-delete.el b/tests/test-pearl-delete.el
index bd412c7..02d3380 100644
--- a/tests/test-pearl-delete.el
+++ b/tests/test-pearl-delete.el
@@ -93,5 +93,21 @@
(cl-letf (((symbol-function 'yes-or-no-p) (lambda (&rest _) t)))
(should-error (pearl-delete-current-issue) :type 'user-error))))
+(ert-deftest test-pearl-delete-current-issue-failure-keeps-subtree ()
+ "A confirmed delete that fails on the remote leaves the subtree and its sibling intact."
+ (test-pearl--in-org
+ "* Header\n\n*** TODO ENG-1 Doomed\n:PROPERTIES:\n:LINEAR-ID: a\n:LINEAR-IDENTIFIER: ENG-1\n:END:\nbody\n*** TODO ENG-2 Survivor\n:PROPERTIES:\n:LINEAR-ID: b\n:END:\n"
+ (cl-letf (((symbol-function 'yes-or-no-p) (lambda (&rest _) t))
+ ((symbol-function 'pearl--delete-issue-async)
+ (lambda (_id cb) (funcall cb '(:success nil)))))
+ (re-search-forward "Doomed")
+ (pearl-delete-current-issue)
+ ;; the failed delete leaves the issue in place ...
+ (goto-char (point-min))
+ (should (re-search-forward "Doomed" nil t))
+ ;; ... and the sibling subtree is untouched.
+ (goto-char (point-min))
+ (should (re-search-forward "Survivor" nil t)))))
+
(provide 'test-pearl-delete)
;;; test-pearl-delete.el ends here