From b7cb1c51e5663419344d8b55766635801f3ee4c8 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 5 Feb 2026 15:13:57 -0600 Subject: =?UTF-8?q?feat(calendar-sync):=20add=20event=20details=20?= =?UTF-8?q?=E2=80=94=20attendees,=20organizer,=20status,=20URL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- tests/test-calendar-sync--parse-organizer.el | 50 ++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 tests/test-calendar-sync--parse-organizer.el (limited to 'tests/test-calendar-sync--parse-organizer.el') 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 -- cgit v1.2.3