aboutsummaryrefslogtreecommitdiff
path: root/tests/test-integration-calendar-sync-recurrence-exceptions.el
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-30 15:12:12 -0400
committerCraig Jennings <c@cjennings.net>2026-06-30 15:12:12 -0400
commitd5e9451022e9254655cc67e015f9d331414d2d76 (patch)
treef19e4572fb65ea698ad6c44005e4f905c214f2dd /tests/test-integration-calendar-sync-recurrence-exceptions.el
parent11e45bee9f101e998131d2938a778c5f52887131 (diff)
downloaddotemacs-d5e9451022e9254655cc67e015f9d331414d2d76.tar.gz
dotemacs-d5e9451022e9254655cc67e015f9d331414d2d76.zip
fix(calendar-sync): drop singly-declined recurring occurrences
Declining one occurrence of a recurring meeting left it on the agenda. Google emits that decline as a RECURRENCE-ID override carrying the user's PARTSTAT=DECLINED. But calendar-sync--parse-exception-event never read the override's attendee block, so the occurrence kept the series' inherited "accepted" status and the declined filter never dropped it. The apply side already re-derives status from an override's attendees. The parse side just wasn't supplying them. The fix parses the override's ATTENDEE lines into :attendees, the same way parse-event does. A unit test covers the extraction. An integration test runs the full parse/apply/filter chain on a declined week.
Diffstat (limited to 'tests/test-integration-calendar-sync-recurrence-exceptions.el')
-rw-r--r--tests/test-integration-calendar-sync-recurrence-exceptions.el44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/test-integration-calendar-sync-recurrence-exceptions.el b/tests/test-integration-calendar-sync-recurrence-exceptions.el
index 0a9b5af1..dde0603a 100644
--- a/tests/test-integration-calendar-sync-recurrence-exceptions.el
+++ b/tests/test-integration-calendar-sync-recurrence-exceptions.el
@@ -162,5 +162,49 @@ Weekly meeting with one instance rescheduled from 09:00 to 10:00."
(should (string-match-p "10:00" org-output))
(should (string-match-p "15:00" org-output))))
+(ert-deftest test-integration-declined-single-occurrence-is-dropped ()
+ "A recurring event with one occurrence declined via a RECURRENCE-ID override
+is filtered out end-to-end, while the other occurrences survive.
+
+This is the singly-declined-occurrence case: declining one instance of a series
+in Google Calendar emits a RECURRENCE-ID override carrying the user's
+PARTSTAT=DECLINED. The override must carry its attendee block all the way from
+`calendar-sync--parse-exception-event' through
+`calendar-sync--apply-single-exception' (status re-derivation) to
+`calendar-sync--filter-declined' for the drop to happen."
+ (let* ((calendar-sync-skip-declined t)
+ (calendar-sync-user-emails '("craig@example.com"))
+ (base-start (test-calendar-sync-time-days-from-now 0 9 0))
+ (base-end (test-calendar-sync-time-days-from-now 0 10 0))
+ (rec-id (test-calendar-sync-time-days-from-now 7 9 0))
+ (decl-start (test-calendar-sync-time-days-from-now 7 9 0))
+ (decl-end (test-calendar-sync-time-days-from-now 7 10 0))
+ (ics-content
+ (concat "BEGIN:VCALENDAR\n"
+ "VERSION:2.0\n"
+ "BEGIN:VEVENT\n"
+ "UID:1on1@google.com\n"
+ "SUMMARY:1on1 with Hayk\n"
+ "DTSTART:" (test-calendar-sync-ics-datetime-local base-start) "\n"
+ "DTEND:" (test-calendar-sync-ics-datetime-local base-end) "\n"
+ "RRULE:FREQ=WEEKLY;COUNT=4\n"
+ "END:VEVENT\n"
+ ;; Week 2 declined: RECURRENCE-ID override with PARTSTAT=DECLINED
+ "BEGIN:VEVENT\n"
+ "UID:1on1@google.com\n"
+ "RECURRENCE-ID:" (test-calendar-sync-ics-datetime-local rec-id) "\n"
+ "SUMMARY:1on1 with Hayk DECLINEDWEEK\n"
+ "ATTENDEE;CN=Craig;PARTSTAT=DECLINED:mailto:craig@example.com\n"
+ "DTSTART:" (test-calendar-sync-ics-datetime-local decl-start) "\n"
+ "DTEND:" (test-calendar-sync-ics-datetime-local decl-end) "\n"
+ "END:VEVENT\n"
+ "END:VCALENDAR"))
+ (org-output (calendar-sync--parse-ics ics-content)))
+ (should (stringp org-output))
+ ;; The non-declined occurrences survive.
+ (should (string-match-p "1on1 with Hayk" org-output))
+ ;; The declined occurrence (unique marker) is dropped.
+ (should-not (string-match-p "DECLINEDWEEK" org-output))))
+
(provide 'test-integration-calendar-sync-recurrence-exceptions)
;;; test-integration-calendar-sync-recurrence-exceptions.el ends here