diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-25 00:10:02 -0400 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-25 00:10:02 -0400 |
| commit | 701d4b0df760874dbc0c9cca4bfc2a1bf0059ea1 (patch) | |
| tree | 866235439329bf65f5ef7c6f596b061fe79652da /tests/test-calendar-sync--apply-single-exception.el | |
| parent | 75beeb556188e06a139e0a006b44a27671763907 (diff) | |
| download | dotemacs-701d4b0df760874dbc0c9cca4bfc2a1bf0059ea1.tar.gz dotemacs-701d4b0df760874dbc0c9cca4bfc2a1bf0059ea1.zip | |
fix(calendar-sync): re-derive status from a declined occurrence override
A recurring event declined for one occurrence still synced with :STATUS: accepted, because apply-single-exception merged the override attendees but never re-derived the user's status from them, so filter-declined never dropped it. Re-derive :status via find-user-status when the exception overrides :attendees, leaving the inherited status when the override doesn't name the user. Four new tests cover declined, accepted, no-attendee, and user-absent overrides.
Diffstat (limited to 'tests/test-calendar-sync--apply-single-exception.el')
| -rw-r--r-- | tests/test-calendar-sync--apply-single-exception.el | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/test-calendar-sync--apply-single-exception.el b/tests/test-calendar-sync--apply-single-exception.el index 3d2342708..f23104d98 100644 --- a/tests/test-calendar-sync--apply-single-exception.el +++ b/tests/test-calendar-sync--apply-single-exception.el @@ -105,5 +105,42 @@ (plist-get (calendar-sync--apply-single-exception occ exc) :url))))) +;;; Status re-derivation from overridden attendees (chime handoff 2026-06-24) + +(ert-deftest test-calendar-sync--apply-single-exception-declined-occurrence-rederives-status () + "Normal: a declined single occurrence re-derives :status from the override attendees." + (let ((calendar-sync-user-emails '("craig@example.com")) + (occ (list :start '(2026 6 24 16 0) :status "accepted" :uid "abc")) + (exc (list :start '(2026 6 24 16 0) + :attendees (list (list :email "craig@example.com" :partstat "DECLINED"))))) + (should (equal "declined" + (plist-get (calendar-sync--apply-single-exception occ exc) :status))))) + +(ert-deftest test-calendar-sync--apply-single-exception-no-attendee-override-keeps-status () + "Boundary: an exception with no attendee block leaves the inherited :status intact." + (let ((calendar-sync-user-emails '("craig@example.com")) + (occ (list :start '(2026 6 24 16 0) :status "accepted" :uid "abc")) + (exc (list :start '(2026 6 24 16 0) :summary "Moved"))) + (should (equal "accepted" + (plist-get (calendar-sync--apply-single-exception occ exc) :status))))) + +(ert-deftest test-calendar-sync--apply-single-exception-accepted-override-stays-accepted () + "Normal: an accepted attendee override keeps :status accepted." + (let ((calendar-sync-user-emails '("craig@example.com")) + (occ (list :start '(2026 6 24 16 0) :status "accepted" :uid "abc")) + (exc (list :start '(2026 6 24 16 0) + :attendees (list (list :email "craig@example.com" :partstat "ACCEPTED"))))) + (should (equal "accepted" + (plist-get (calendar-sync--apply-single-exception occ exc) :status))))) + +(ert-deftest test-calendar-sync--apply-single-exception-override-without-user-keeps-status () + "Boundary: override attendees that don't include the user leave :status intact." + (let ((calendar-sync-user-emails '("craig@example.com")) + (occ (list :start '(2026 6 24 16 0) :status "accepted" :uid "abc")) + (exc (list :start '(2026 6 24 16 0) + :attendees (list (list :email "someone@else.com" :partstat "DECLINED"))))) + (should (equal "accepted" + (plist-get (calendar-sync--apply-single-exception occ exc) :status))))) + (provide 'test-calendar-sync--apply-single-exception) ;;; test-calendar-sync--apply-single-exception.el ends here |
