diff options
Diffstat (limited to 'tests/test-pearl-org-write.el')
| -rw-r--r-- | tests/test-pearl-org-write.el | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/test-pearl-org-write.el b/tests/test-pearl-org-write.el index 6c30380..e467436 100644 --- a/tests/test-pearl-org-write.el +++ b/tests/test-pearl-org-write.el @@ -69,19 +69,20 @@ (should-not (string-match-p "old content" (buffer-string))))))) (ert-deftest test-pearl-update-org-dirty-buffer-not-overwritten () - "A buffer with unsaved edits is left untouched, not clobbered." + "Cancelling the dirty-refresh prompt leaves a buffer with unsaved edits untouched." (test-pearl--with-org-file tmp (let ((buf (find-file-noselect tmp))) (with-current-buffer buf (insert "unsaved edits")) - (pearl--update-org-from-issues test-pearl--sample-issues) + (cl-letf (((symbol-function 'pearl--dirty-refresh-choice) (lambda (_p) ?q))) + (pearl--update-org-from-issues test-pearl--sample-issues)) (with-current-buffer buf (should (buffer-modified-p)) (should (string-match-p "unsaved edits" (buffer-string))) (should-not (string-match-p "ENG-1" (buffer-string))))))) (ert-deftest test-pearl-update-org-dirty-buffer-preserves-disk-and-surfaces () - "A dirty buffer is left as-is, the on-disk file is untouched, and the buffer is surfaced." + "Cancelling the prompt leaves the dirty buffer and on-disk file as-is, and surfaces it." (test-pearl--with-org-file tmp (let ((buf (find-file-noselect tmp)) (surfaced nil)) @@ -92,7 +93,8 @@ (goto-char (point-max)) (insert "UNSAVED EDIT\n")) (cl-letf (((symbol-function 'pearl--surface-buffer) - (lambda (b) (setq surfaced b)))) + (lambda (b) (setq surfaced b))) + ((symbol-function 'pearl--dirty-refresh-choice) (lambda (_p) ?q))) (pearl--update-org-from-issues test-pearl--sample-issues)) ;; buffer keeps the unsaved edit and stays modified (with-current-buffer buf |
