aboutsummaryrefslogtreecommitdiff
path: root/tests/test-mail-config.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-12 00:34:03 -0500
committerCraig Jennings <c@cjennings.net>2026-05-12 00:34:03 -0500
commit22232fc39598ffc065ee134889c3143566be5faa (patch)
treed72f4630ead87023b7e17ceeeabceb7db3f8b3c0 /tests/test-mail-config.el
parentcd0b90dc74996f7bd7b897834bac7038ffb7f5b8 (diff)
downloaddotemacs-22232fc39598ffc065ee134889c3143566be5faa.tar.gz
dotemacs-22232fc39598ffc065ee134889c3143566be5faa.zip
refactor(mail): extract the mu4e attachment workflow into its own module
The attachment-save UI (the MIME-part filters, the three save commands, and the `special-mode'-derived selection buffer) was ~230 lines in `mail-config.el' and depended on nothing else there. It moves to `modules/mu4e-attachments.el', which `mail-config' now requires. `cj/email-map' and its C-; e bindings stay put. The keymap just points at commands that now live next door. The unit tests move with it: `test-mail-config-attachments.el' becomes `test-mu4e-attachments.el' and requires the new module directly instead of pulling in the whole mu4e and org-msg use-package stack. The two tests that check `cj/email-map' wiring move to a new `test-mail-config.el', since that map belongs to `mail-config'. One of the moved tests quietly relied on a real mu4e install (it loaded `mu4e-mime-parts' through a load-path entry that loading `mail-config' happens to add), so it now stubs that path itself.
Diffstat (limited to 'tests/test-mail-config.el')
-rw-r--r--tests/test-mail-config.el24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/test-mail-config.el b/tests/test-mail-config.el
new file mode 100644
index 00000000..d2e2cc0b
--- /dev/null
+++ b/tests/test-mail-config.el
@@ -0,0 +1,24 @@
+;;; test-mail-config.el --- Tests for mail-config keymap wiring -*- lexical-binding: t; -*-
+
+;;; Commentary:
+;; Tests that mail-config wires the attachment-save commands (defined in
+;; `mu4e-attachments') into its `cj/email-map' prefix keymap.
+
+;;; Code:
+
+(require 'ert)
+
+(add-to-list 'load-path (expand-file-name "modules" user-emacs-directory))
+(require 'mail-config)
+
+(ert-deftest test-mail-config-email-map-attachment-bindings ()
+ "Normal: the email prefix map routes to the attachment-save commands."
+ (should (eq (lookup-key cj/email-map (kbd "S"))
+ #'cj/mu4e-save-all-attachments))
+ (should (eq (lookup-key cj/email-map (kbd "s"))
+ #'cj/mu4e-save-attachment-here))
+ (should (eq (lookup-key cj/email-map (kbd "m"))
+ #'cj/mu4e-save-some-attachments)))
+
+(provide 'test-mail-config)
+;;; test-mail-config.el ends here