summaryrefslogtreecommitdiff
path: root/tests/test-calendar-sync--event-to-org.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-02-06 10:15:08 -0600
committerCraig Jennings <c@cjennings.net>2026-02-06 10:15:08 -0600
commita980541c7300001181a25c2ed80401766d3abcaa (patch)
tree1418a96c09172efb9d7b8b8c79bf483f38000326 /tests/test-calendar-sync--event-to-org.el
parent00ddf74b232b0762baa7826e62f6765d087041fb (diff)
fix(calendar-sync): sanitize description text to prevent org heading corruption
Event descriptions containing lines starting with * were being interpreted as org headings, breaking file structure. Replace leading asterisks with dashes before writing descriptions.
Diffstat (limited to 'tests/test-calendar-sync--event-to-org.el')
-rw-r--r--tests/test-calendar-sync--event-to-org.el11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/test-calendar-sync--event-to-org.el b/tests/test-calendar-sync--event-to-org.el
index 96ce49d5..a3dc0106 100644
--- a/tests/test-calendar-sync--event-to-org.el
+++ b/tests/test-calendar-sync--event-to-org.el
@@ -92,7 +92,7 @@
(should (string-match-p ":END:" result)))))
(ert-deftest test-calendar-sync--event-to-org-boundary-description-with-asterisks ()
- "Test event description containing org-special asterisks."
+ "Test event description containing org-special asterisks are sanitized."
(let* ((start (test-calendar-sync-time-days-from-now 5 14 0))
(end (test-calendar-sync-time-days-from-now 5 15 0))
(event (list :summary "Meeting"
@@ -100,8 +100,13 @@
:end end
:description "* agenda item 1\n** sub-item")))
(let ((result (calendar-sync--event-to-org event)))
- ;; Description should be present
- (should (string-match-p "agenda item" result)))))
+ ;; Description content should be present
+ (should (string-match-p "agenda item" result))
+ ;; Leading asterisks replaced with dashes to prevent org heading conflicts
+ (should (string-match-p "^- agenda item 1" result))
+ (should (string-match-p "^-- sub-item" result))
+ ;; Only the event heading should use *
+ (should (= 1 (length (split-string result "^\\* " t)))))))
(ert-deftest test-calendar-sync--event-to-org-boundary-organizer-email-only ()
"Test organizer without CN shows email."