diff options
| author | Craig Jennings <c@cjennings.net> | 2026-02-05 15:13:57 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-02-05 15:13:57 -0600 |
| commit | b7cb1c51e5663419344d8b55766635801f3ee4c8 (patch) | |
| tree | a13d903c1d7d82d8b49fe7edbd5f9b7652592c23 /tests/test-calendar-sync--parse-organizer.el | |
| parent | 12f36cb887c3e84741bc2f3d6afd9e71c6ffddd7 (diff) | |
feat(calendar-sync): add event details — attendees, organizer, status, URL
Add ICS text unescaping (RFC 5545), HTML stripping, and new fields
(attendees/status, organizer, meeting URL) to calendar-sync.el.
event-to-org now outputs org property drawers. 88 new tests across
10 test files, 146/146 pass. Also fix pre-existing test require
order and keymap guard issues.
Diffstat (limited to 'tests/test-calendar-sync--parse-organizer.el')
| -rw-r--r-- | tests/test-calendar-sync--parse-organizer.el | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/test-calendar-sync--parse-organizer.el b/tests/test-calendar-sync--parse-organizer.el new file mode 100644 index 00000000..5f21d902 --- /dev/null +++ b/tests/test-calendar-sync--parse-organizer.el @@ -0,0 +1,50 @@ +;;; test-calendar-sync--parse-organizer.el --- Tests for organizer parsing -*- lexical-binding: t; -*- + +;;; Commentary: +;; Unit tests for calendar-sync--parse-organizer function. +;; Parses ORGANIZER property line into plist (:cn NAME :email EMAIL). +;; Covers Normal, Boundary, and Error cases. + +;;; Code: + +(require 'ert) +(require 'testutil-calendar-sync) +(require 'calendar-sync) + +;;; Normal Cases + +(ert-deftest test-calendar-sync--parse-organizer-normal-cn-and-email () + "Test parsing organizer with both CN and email." + (let ((event "BEGIN:VEVENT\nORGANIZER;CN=John Smith:mailto:john@example.com\nSUMMARY:Test\nEND:VEVENT")) + (let ((result (calendar-sync--parse-organizer event))) + (should (string= "John Smith" (plist-get result :cn))) + (should (string= "john@example.com" (plist-get result :email)))))) + +(ert-deftest test-calendar-sync--parse-organizer-normal-no-cn () + "Test parsing organizer without CN." + (let ((event "BEGIN:VEVENT\nORGANIZER:mailto:organizer@example.com\nSUMMARY:Test\nEND:VEVENT")) + (let ((result (calendar-sync--parse-organizer event))) + (should (null (plist-get result :cn))) + (should (string= "organizer@example.com" (plist-get result :email)))))) + +;;; Boundary Cases + +(ert-deftest test-calendar-sync--parse-organizer-boundary-no-organizer () + "Test event without ORGANIZER returns nil." + (let ((event "BEGIN:VEVENT\nSUMMARY:Test\nDTSTART:20260210T140000Z\nEND:VEVENT")) + (should (null (calendar-sync--parse-organizer event))))) + +(ert-deftest test-calendar-sync--parse-organizer-boundary-complex-cn () + "Test organizer with complex CN (quotes, special chars)." + (let ((event "BEGIN:VEVENT\nORGANIZER;CN=\"Dr. Jane O'Brien\":mailto:jane@example.com\nSUMMARY:Test\nEND:VEVENT")) + (let ((result (calendar-sync--parse-organizer event))) + (should (plist-get result :email))))) + +;;; Error Cases + +(ert-deftest test-calendar-sync--parse-organizer-error-nil-event () + "Test nil event returns nil." + (should (null (calendar-sync--parse-organizer nil)))) + +(provide 'test-calendar-sync--parse-organizer) +;;; test-calendar-sync--parse-organizer.el ends here |
