aboutsummaryrefslogtreecommitdiff
path: root/tests/test-mail-config-attachments.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-11 18:17:22 -0500
committerCraig Jennings <c@cjennings.net>2026-05-11 18:17:22 -0500
commite0e0ecdb86e3ae1772adcedb50e6c9caa210cf17 (patch)
tree41a16c890b1ffb588635266d45fc484beb85f9de /tests/test-mail-config-attachments.el
parentfc94e5b7101f6677950c414c2822b451351ccc56 (diff)
downloaddotemacs-e0e0ecdb86e3ae1772adcedb50e6c9caa210cf17.tar.gz
dotemacs-e0e0ecdb86e3ae1772adcedb50e6c9caa210cf17.zip
test: close coverage gaps from the preceding batch
Untested paths surfaced while reviewing the preceding feature/fix commits: - calendar-sync: a test that `-L' precedes `-l' in the worker command (separate `member' checks wouldn't catch a swap), plus a `:slow' tag on the real-subprocess worker test so it stays out of the default `make test' run. - org-capture cache: a killed marker buffer invalidates the entry and the next resolution rescans without erroring on the stale marker, `cj/org-capture-clear-target-cache' actually empties the hash, and non-`file+headline' targets (`file', `file+olp', `file+function') fall through to the original `org-capture-set-target-location'. - lorem-optimum: `cj/lipsum-title' on an empty chain returns "", not an error. - calibredb-epub: a negative `cj/nov-margin-percent' is clamped up to 0 (text takes the full window width). - mu4e attachments: the default save directory comes from the part's `:target-dir' and falls back to `~/Downloads/', and asking for the attachment at point on a header line fails with a `user-error'.
Diffstat (limited to 'tests/test-mail-config-attachments.el')
-rw-r--r--tests/test-mail-config-attachments.el25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test-mail-config-attachments.el b/tests/test-mail-config-attachments.el
index eee0ff708..fae50c9cc 100644
--- a/tests/test-mail-config-attachments.el
+++ b/tests/test-mail-config-attachments.el
@@ -233,5 +233,30 @@
(should (eq (lookup-key cj/email-map (kbd "m"))
#'cj/mu4e-save-some-attachments)))
+(ert-deftest test-mail-config-attachments-default-directory-uses-target-dir ()
+ "Normal: the default save directory comes from the part's :target-dir."
+ (let ((parts (list (test-mail-config-attachment--part "a.pdf" 1))))
+ (should (equal (cj/mu4e--attachment-default-directory parts)
+ "/tmp/mail-target/"))))
+
+(ert-deftest test-mail-config-attachments-default-directory-falls-back-to-downloads ()
+ "Boundary: with no :target-dir hint, the default is ~/Downloads/."
+ (let ((parts (list (list :filename "a.pdf" :part-index 1 :attachment-like t))))
+ (should (equal (cj/mu4e--attachment-default-directory parts)
+ (file-name-as-directory (expand-file-name "~/Downloads/"))))))
+
+(ert-deftest test-mail-config-attachments-selection-entry-at-point-errors-off-row ()
+ "Error: asking for the attachment at point on a header line fails clearly."
+ (let* ((a (test-mail-config-attachment--part "a.pdf" 1))
+ (buffer (get-buffer-create "*test-mail-attachments*")))
+ (unwind-protect
+ (with-current-buffer buffer
+ (cj/mu4e-attachment-selection-mode)
+ (cj/mu4e--attachment-selection-setup (list a) "/downloads/")
+ (goto-char (point-min)) ; first line is the "Save attachments to:" header
+ (should-error (cj/mu4e--attachment-selection-entry-at-point)
+ :type 'user-error))
+ (kill-buffer buffer))))
+
(provide 'test-mail-config-attachments)
;;; test-mail-config-attachments.el ends here