diff options
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/test-calendar-sync--expand-monthly.el | 4 | ||||
| -rw-r--r-- | tests/test-org-roam-config-format.el | 22 |
2 files changed, 18 insertions, 8 deletions
diff --git a/tests/test-calendar-sync--expand-monthly.el b/tests/test-calendar-sync--expand-monthly.el index 75404937..41b196a7 100644 --- a/tests/test-calendar-sync--expand-monthly.el +++ b/tests/test-calendar-sync--expand-monthly.el @@ -278,8 +278,10 @@ instead of the RFC 5545 skip." :start '(2030 1 31 10 0) :end '(2030 1 31 11 0))) (rrule (list :freq 'monthly :interval 1)) + ;; End the range past Dec 31: the range end is midnight, so ending + ;; ON the 31st would exclude that day's 10:00 occurrence. (range (list (calendar-sync--date-to-time '(2030 1 1)) - (calendar-sync--date-to-time '(2030 12 31)))) + (calendar-sync--date-to-time '(2031 1 1)))) (occurrences (calendar-sync--expand-monthly base-event rrule range)) (months (mapcar (lambda (o) (nth 1 (plist-get o :start))) occurrences)) (days (mapcar (lambda (o) (nth 2 (plist-get o :start))) occurrences))) diff --git a/tests/test-org-roam-config-format.el b/tests/test-org-roam-config-format.el index caafe563..16370ca1 100644 --- a/tests/test-org-roam-config-format.el +++ b/tests/test-org-roam-config-format.el @@ -147,13 +147,21 @@ Returns the formatted file content." (let ((result (test-format "Title" "id" "* Content"))) (should (string-match-p "#\\+FILETAGS: Topic\n\n\\* Content" result)))) -(ert-deftest test-org-roam-config-capture-templates-declared-special () - "Normal: org-roam-capture-templates is declared special in the module. -cj/org-roam-node-insert-immediate let-binds it; without the defvar the -byte-compiled let is a dead lexical binding and :immediate-finish never -reaches org-roam-node-insert -- the \"immediate\" insert opens a capture -buffer." - (should (special-variable-p 'org-roam-capture-templates))) +(defvar org-roam-capture-templates) + +(ert-deftest test-org-roam-config-immediate-insert-binding-is-dynamic () + "Normal: the immediate-insert template binding reaches the insert call. +Without the module's defvar, the byte-compiled let is a dead lexical +binding: org-roam-node-insert would see the untouched global templates +and :immediate-finish never applies -- the \"immediate\" insert opens a +capture buffer. Asserted behaviorally (not via special-variable-p, +whose answer differs between the package-loaded and bare batch envs)." + (let ((org-roam-capture-templates '(("d" "default"))) + seen) + (cl-letf (((symbol-function 'org-roam-node-insert) + (lambda (&rest _) (setq seen org-roam-capture-templates)))) + (cj/org-roam-node-insert-immediate nil)) + (should (equal seen '(("d" "default" :immediate-finish t)))))) (provide 'test-org-roam-config-format) ;;; test-org-roam-config-format.el ends here |
