calendar: add overnight BST event snapshot tests #85
@@ -909,6 +909,179 @@ async fn test_empty_calendar() {
|
||||
insta::assert_snapshot!(result, @"No events found between [Monday 01 January 2024] and [Tuesday 31 December 2024].");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_overnight_event_spans_midnight_sunday_only() {
|
||||
let fixture = RadicaleFixture::start().await;
|
||||
fixture.create_calendar("personal").await;
|
||||
|
||||
// 18:30 BST = 17:30 UTC, 02:45 BST = 01:45 UTC
|
||||
fixture
|
||||
.put_event(
|
||||
"personal",
|
||||
"overnight.ics",
|
||||
"BEGIN:VCALENDAR\r\n\
|
||||
VERSION:2.0\r\n\
|
||||
PRODID:-//Test//Test//EN\r\n\
|
||||
BEGIN:VTIMEZONE\r\n\
|
||||
TZID:Europe/London\r\n\
|
||||
BEGIN:DAYLIGHT\r\n\
|
||||
TZOFFSETFROM:+0000\r\n\
|
||||
TZOFFSETTO:+0100\r\n\
|
||||
TZNAME:BST\r\n\
|
||||
DTSTART:19700329T010000\r\n\
|
||||
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU\r\n\
|
||||
END:DAYLIGHT\r\n\
|
||||
BEGIN:STANDARD\r\n\
|
||||
TZOFFSETFROM:+0100\r\n\
|
||||
TZOFFSETTO:+0000\r\n\
|
||||
TZNAME:GMT\r\n\
|
||||
DTSTART:19701025T020000\r\n\
|
||||
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU\r\n\
|
||||
END:STANDARD\r\n\
|
||||
END:VTIMEZONE\r\n\
|
||||
BEGIN:VEVENT\r\n\
|
||||
UID:overnight@example.com\r\n\
|
||||
DTSTART;TZID=Europe/London:20260517T183000\r\n\
|
||||
DTEND;TZID=Europe/London:20260518T024500\r\n\
|
||||
SUMMARY:Overnight Event\r\n\
|
||||
END:VEVENT\r\n\
|
||||
END:VCALENDAR",
|
||||
)
|
||||
.await;
|
||||
|
||||
let tools = fixture.calendar_tools("personal").await;
|
||||
|
||||
let result = tools
|
||||
.list_events(&serde_json::json!({
|
||||
"start_date": "2026-05-17",
|
||||
"calendar_name": "personal"
|
||||
}))
|
||||
.await
|
||||
.expect("list_events failed");
|
||||
|
||||
insta::assert_snapshot!(redact_for_snapshot(&result), @"
|
||||
Found 1 events:
|
||||
[/testuser/CALENDAR/overnight.ics] Overnight Event — [Sunday 17 May 2026 17:30 UTC] - [Monday 18 May 2026 01:45 UTC]
|
||||
|
||||
Use calendar_get_event with an event ID for full details.
|
||||
");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_overnight_event_spans_midnight_monday_only() {
|
||||
let fixture = RadicaleFixture::start().await;
|
||||
fixture.create_calendar("personal").await;
|
||||
|
||||
fixture
|
||||
.put_event(
|
||||
"personal",
|
||||
"overnight.ics",
|
||||
"BEGIN:VCALENDAR\r\n\
|
||||
VERSION:2.0\r\n\
|
||||
PRODID:-//Test//Test//EN\r\n\
|
||||
BEGIN:VTIMEZONE\r\n\
|
||||
TZID:Europe/London\r\n\
|
||||
BEGIN:DAYLIGHT\r\n\
|
||||
TZOFFSETFROM:+0000\r\n\
|
||||
TZOFFSETTO:+0100\r\n\
|
||||
TZNAME:BST\r\n\
|
||||
DTSTART:19700329T010000\r\n\
|
||||
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU\r\n\
|
||||
END:DAYLIGHT\r\n\
|
||||
BEGIN:STANDARD\r\n\
|
||||
TZOFFSETFROM:+0100\r\n\
|
||||
TZOFFSETTO:+0000\r\n\
|
||||
TZNAME:GMT\r\n\
|
||||
DTSTART:19701025T020000\r\n\
|
||||
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU\r\n\
|
||||
END:STANDARD\r\n\
|
||||
END:VTIMEZONE\r\n\
|
||||
BEGIN:VEVENT\r\n\
|
||||
UID:overnight@example.com\r\n\
|
||||
DTSTART;TZID=Europe/London:20260517T183000\r\n\
|
||||
DTEND;TZID=Europe/London:20260518T024500\r\n\
|
||||
SUMMARY:Overnight Event\r\n\
|
||||
END:VEVENT\r\n\
|
||||
END:VCALENDAR",
|
||||
)
|
||||
.await;
|
||||
|
||||
let tools = fixture.calendar_tools("personal").await;
|
||||
|
||||
let result = tools
|
||||
.list_events(&serde_json::json!({
|
||||
"start_date": "2026-05-18",
|
||||
"calendar_name": "personal"
|
||||
}))
|
||||
.await
|
||||
.expect("list_events failed");
|
||||
|
||||
insta::assert_snapshot!(redact_for_snapshot(&result), @"
|
||||
Found 1 events:
|
||||
[/testuser/CALENDAR/overnight.ics] Overnight Event — [Sunday 17 May 2026 17:30 UTC] - [Monday 18 May 2026 01:45 UTC]
|
||||
|
||||
Use calendar_get_event with an event ID for full details.
|
||||
");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_overnight_event_spans_midnight_range() {
|
||||
let fixture = RadicaleFixture::start().await;
|
||||
fixture.create_calendar("personal").await;
|
||||
|
||||
fixture
|
||||
.put_event(
|
||||
"personal",
|
||||
"overnight.ics",
|
||||
"BEGIN:VCALENDAR\r\n\
|
||||
VERSION:2.0\r\n\
|
||||
PRODID:-//Test//Test//EN\r\n\
|
||||
BEGIN:VTIMEZONE\r\n\
|
||||
TZID:Europe/London\r\n\
|
||||
BEGIN:DAYLIGHT\r\n\
|
||||
TZOFFSETFROM:+0000\r\n\
|
||||
TZOFFSETTO:+0100\r\n\
|
||||
TZNAME:BST\r\n\
|
||||
DTSTART:19700329T010000\r\n\
|
||||
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU\r\n\
|
||||
END:DAYLIGHT\r\n\
|
||||
BEGIN:STANDARD\r\n\
|
||||
TZOFFSETFROM:+0100\r\n\
|
||||
TZOFFSETTO:+0000\r\n\
|
||||
TZNAME:GMT\r\n\
|
||||
DTSTART:19701025T020000\r\n\
|
||||
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU\r\n\
|
||||
END:STANDARD\r\n\
|
||||
END:VTIMEZONE\r\n\
|
||||
BEGIN:VEVENT\r\n\
|
||||
UID:overnight@example.com\r\n\
|
||||
DTSTART;TZID=Europe/London:20260517T183000\r\n\
|
||||
DTEND;TZID=Europe/London:20260518T024500\r\n\
|
||||
SUMMARY:Overnight Event\r\n\
|
||||
END:VEVENT\r\n\
|
||||
END:VCALENDAR",
|
||||
)
|
||||
.await;
|
||||
|
||||
let tools = fixture.calendar_tools("personal").await;
|
||||
|
||||
let result = tools
|
||||
.list_events(&serde_json::json!({
|
||||
"start_date": "2026-05-17",
|
||||
"end_date": "2026-05-18",
|
||||
"calendar_name": "personal"
|
||||
}))
|
||||
.await
|
||||
.expect("list_events failed");
|
||||
|
||||
insta::assert_snapshot!(redact_for_snapshot(&result), @"
|
||||
Found 1 events:
|
||||
[/testuser/CALENDAR/overnight.ics] Overnight Event — [Sunday 17 May 2026 17:30 UTC] - [Monday 18 May 2026 01:45 UTC]
|
||||
|
||||
Use calendar_get_event with an event ID for full details.
|
||||
");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn test_events_with_attendees() {
|
||||
let fixture = RadicaleFixture::start().await;
|
||||
|
||||
Reference in new issue
Block a user