aboutsummaryrefslogtreecommitdiff
path: root/tests/test-ai-config-gptel-magit-lazy-loading.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-15 23:48:20 -0500
committerCraig Jennings <c@cjennings.net>2026-05-15 23:48:20 -0500
commit3b4c8d8915d469b0bfbb148820bca7a31dcd734a (patch)
treeba2c480fb29d3308d59457235b49b3b0add62af3 /tests/test-ai-config-gptel-magit-lazy-loading.el
parent2dd56761df8e6b6d7b5f99c5c7c6d20f5b2d6447 (diff)
downloaddotemacs-3b4c8d8915d469b0bfbb148820bca7a31dcd734a.tar.gz
dotemacs-3b4c8d8915d469b0bfbb148820bca7a31dcd734a.zip
fix(ai-config): Ensure gptel-magit is installed via use-package
Replace raw autoload calls with a `use-package` declaration so `use-package-always-ensure` installs gptel-magit on machines that haven't run `package-install`, fixing the "Cannot open load file" error on transient setup.
Diffstat (limited to 'tests/test-ai-config-gptel-magit-lazy-loading.el')
-rw-r--r--tests/test-ai-config-gptel-magit-lazy-loading.el16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test-ai-config-gptel-magit-lazy-loading.el b/tests/test-ai-config-gptel-magit-lazy-loading.el
index 05e3634d..bc345ef0 100644
--- a/tests/test-ai-config-gptel-magit-lazy-loading.el
+++ b/tests/test-ai-config-gptel-magit-lazy-loading.el
@@ -123,5 +123,21 @@ a gptel-magit function is called."
One for magit-commit (generate) and one for magit-diff (explain)."
(should (= 2 (length test-gptel-magit--transient-calls))))
+;;; Error Cases — Install behavior
+
+(ert-deftest test-ai-config-gptel-magit-declared-via-use-package ()
+ "ai-config should declare gptel-magit via `use-package' so it gets installed.
+Raw `(autoload ...)' calls register the function name but leave the
+package uninstalled on machines that never ran `package-install'. The
+\\=`use-package' form inherits `use-package-always-ensure' from
+early-init, which is how every other package in this config gets
+onto `load-path' before its autoloads fire."
+ (let ((source-file (expand-file-name "modules/ai-config.el"
+ user-emacs-directory)))
+ (with-temp-buffer
+ (insert-file-contents source-file)
+ (goto-char (point-min))
+ (should (re-search-forward "(use-package gptel-magit\\b" nil t)))))
+
(provide 'test-ai-config-gptel-magit-lazy-loading)
;;; test-ai-config-gptel-magit-lazy-loading.el ends here