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--get-all-property-lines.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--get-all-property-lines.el')
| -rw-r--r-- | tests/test-calendar-sync--get-all-property-lines.el | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/test-calendar-sync--get-all-property-lines.el b/tests/test-calendar-sync--get-all-property-lines.el new file mode 100644 index 00000000..c95041c9 --- /dev/null +++ b/tests/test-calendar-sync--get-all-property-lines.el @@ -0,0 +1,61 @@ +;;; test-calendar-sync--get-all-property-lines.el --- Tests for get-all-property-lines -*- lexical-binding: t; -*- + +;;; Commentary: +;; Unit tests for calendar-sync--get-all-property-lines function. +;; Like get-property-line but returns ALL matching lines. +;; Needed because ATTENDEE appears multiple times in an event. +;; Covers Normal, Boundary, and Error cases. + +;;; Code: + +(require 'ert) +(require 'testutil-calendar-sync) +(require 'calendar-sync) + +;;; Normal Cases + +(ert-deftest test-calendar-sync--get-all-property-lines-normal-multiple () + "Test extracting multiple ATTENDEE lines." + (let ((event "BEGIN:VEVENT\nATTENDEE;CN=Alice:mailto:alice@example.com\nATTENDEE;CN=Bob:mailto:bob@example.com\nEND:VEVENT")) + (let ((result (calendar-sync--get-all-property-lines event "ATTENDEE"))) + (should (= 2 (length result))) + (should (string-match-p "Alice" (nth 0 result))) + (should (string-match-p "Bob" (nth 1 result)))))) + +(ert-deftest test-calendar-sync--get-all-property-lines-normal-single () + "Test extracting single matching line." + (let ((event "BEGIN:VEVENT\nATTENDEE;CN=Alice:mailto:alice@example.com\nSUMMARY:Test\nEND:VEVENT")) + (let ((result (calendar-sync--get-all-property-lines event "ATTENDEE"))) + (should (= 1 (length result))) + (should (string-match-p "Alice" (car result)))))) + +;;; Boundary Cases + +(ert-deftest test-calendar-sync--get-all-property-lines-boundary-no-match () + "Test no matching property returns empty list." + (let ((event "BEGIN:VEVENT\nSUMMARY:Test\nEND:VEVENT")) + (should (null (calendar-sync--get-all-property-lines event "ATTENDEE"))))) + +(ert-deftest test-calendar-sync--get-all-property-lines-boundary-continuation () + "Test handling of continuation lines (lines starting with space)." + (let ((event "BEGIN:VEVENT\nATTENDEE;CN=Very Long Name;PARTSTAT=ACCEPTED:\n mailto:longname@example.com\nSUMMARY:Test\nEND:VEVENT")) + (let ((result (calendar-sync--get-all-property-lines event "ATTENDEE"))) + (should (= 1 (length result))) + (should (string-match-p "longname@example.com" (car result)))))) + +;;; Error Cases + +(ert-deftest test-calendar-sync--get-all-property-lines-error-nil-event () + "Test nil event returns nil." + (should (null (calendar-sync--get-all-property-lines nil "ATTENDEE")))) + +(ert-deftest test-calendar-sync--get-all-property-lines-error-nil-property () + "Test nil property returns nil." + (should (null (calendar-sync--get-all-property-lines "BEGIN:VEVENT\nEND:VEVENT" nil)))) + +(ert-deftest test-calendar-sync--get-all-property-lines-error-empty-event () + "Test empty event string returns nil." + (should (null (calendar-sync--get-all-property-lines "" "ATTENDEE")))) + +(provide 'test-calendar-sync--get-all-property-lines) +;;; test-calendar-sync--get-all-property-lines.el ends here |
