aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-24 06:54:02 -0400
committerCraig Jennings <c@cjennings.net>2026-06-24 06:54:02 -0400
commit1699a76a71ba9dd26d0fb3efe22baf43726521d4 (patch)
tree54592514c2ca54da327dc4aa52f79d0390521395 /tests
parent212e02c0fde0ccdbcabb6d023544cadb0e67f1f3 (diff)
downloaddotemacs-1699a76a71ba9dd26d0fb3efe22baf43726521d4.tar.gz
dotemacs-1699a76a71ba9dd26d0fb3efe22baf43726521d4.zip
fix(org-agenda): filter missing base files; drop the roam-source doc claim
cj/--org-agenda-base-files now drops files that do not exist (a fresh machine may lack the synced calendars or the inbox), and org-agenda-skip-unavailable-files is set as a backstop, so org-agenda never prompts to create a missing path — the interactive-prompt class that once hung the chime daemon. The filter lives in the one shared helper, so the agenda builders, single-project view, and the chime initializer all get the existence check. Also correct the docs: the commentary and docstrings claimed org-roam nodes tagged "Project" are agenda sources, but they were never scanned; roam Project/Topic notes are refile targets (org-refile-config.el), not agenda sources. Claude-Session: https://claude.ai/code/session_01BqrdWUo9GcznYX2pZr76gZ
Diffstat (limited to 'tests')
-rw-r--r--tests/test-org-agenda-config--base-files.el57
1 files changed, 40 insertions, 17 deletions
diff --git a/tests/test-org-agenda-config--base-files.el b/tests/test-org-agenda-config--base-files.el
index c6939b4d7..bd202a195 100644
--- a/tests/test-org-agenda-config--base-files.el
+++ b/tests/test-org-agenda-config--base-files.el
@@ -3,8 +3,11 @@
;;; Commentary:
;; cj/--org-agenda-base-files is the single source of the fixed agenda base list
;; (inbox, schedule, and the three calendars) that was previously spelled out as
-;; a literal in three places. The path vars are special (defvar'd in
-;; user-constants), so they can be dynamically bound here.
+;; a literal in three places. It now drops files that do not exist so org-agenda
+;; never prompts to create a missing path (the hang class). The path vars are
+;; special (defvar'd in user-constants), so they can be dynamically bound; tests
+;; use real temp files for "exists" rather than mocking the `file-exists-p'
+;; primitive.
;;; Code:
@@ -13,24 +16,44 @@
(add-to-list 'load-path (expand-file-name "modules" user-emacs-directory))
(require 'org-agenda-config)
-(ert-deftest test-org-agenda-base-files-returns-fixed-list-in-order ()
- "Normal: returns inbox, schedule, gcal, pcal, dcal in that order."
- (let ((inbox-file "/i")
- (schedule-file "/s")
- (gcal-file "/g")
- (pcal-file "/p")
- (dcal-file "/d"))
- (should (equal (cj/--org-agenda-base-files)
- '("/i" "/s" "/g" "/p" "/d")))))
+(defun test-oa-base--tmp ()
+ "Return a fresh existing temp file path."
+ (make-temp-file "oa-base-"))
+
+(ert-deftest test-org-agenda-base-files-returns-existing-in-order ()
+ "Normal: returns inbox, schedule, gcal, pcal, dcal (all existing) in order."
+ (let* ((i (test-oa-base--tmp)) (s (test-oa-base--tmp)) (g (test-oa-base--tmp))
+ (p (test-oa-base--tmp)) (d (test-oa-base--tmp))
+ (inbox-file i) (schedule-file s) (gcal-file g) (pcal-file p) (dcal-file d))
+ (unwind-protect
+ (should (equal (cj/--org-agenda-base-files) (list i s g p d)))
+ (dolist (f (list i s g p d)) (ignore-errors (delete-file f))))))
(ert-deftest test-org-agenda-base-files-reflects-current-values ()
"Boundary: the helper reads the vars at call time (not a captured snapshot)."
- (let ((inbox-file "first")
- (schedule-file "x") (gcal-file "x") (pcal-file "x") (dcal-file "x"))
- (should (equal (car (cj/--org-agenda-base-files)) "first"))
- (setq inbox-file "second")
- (should (equal (car (cj/--org-agenda-base-files)) "second"))
- (should (= (length (cj/--org-agenda-base-files)) 5))))
+ (let* ((a (test-oa-base--tmp)) (b (test-oa-base--tmp))
+ (inbox-file a) (schedule-file b) (gcal-file b) (pcal-file b) (dcal-file b))
+ (unwind-protect
+ (progn
+ (should (equal (car (cj/--org-agenda-base-files)) a))
+ (setq inbox-file b)
+ (should (equal (car (cj/--org-agenda-base-files)) b))
+ (should (= (length (cj/--org-agenda-base-files)) 5)))
+ (ignore-errors (delete-file a))
+ (ignore-errors (delete-file b)))))
+
+(ert-deftest test-org-agenda-base-files-drops-missing-files ()
+ "Boundary/Error: files that do not exist are dropped, so a fresh machine
+without synced calendars never hands org-agenda a path it would prompt to create."
+ (let* ((i (test-oa-base--tmp)) (s (test-oa-base--tmp))
+ (inbox-file i) (schedule-file s)
+ (gcal-file "/no/such/gcal.org")
+ (pcal-file "/no/such/pcal.org")
+ (dcal-file "/no/such/dcal.org"))
+ (unwind-protect
+ (should (equal (cj/--org-agenda-base-files) (list i s)))
+ (ignore-errors (delete-file i))
+ (ignore-errors (delete-file s)))))
(provide 'test-org-agenda-config--base-files)
;;; test-org-agenda-config--base-files.el ends here