#!perl
use Cassandane::Tiny;

sub test_calendarevent_guesstz_recur
    :min_version_3_5 :needs_component_jmap :needs_dependency_guesstz
{
    my ($self) = @_;
    my $jmap = $self->{jmap};
    my $caldav = $self->{caldav};

    my $eventId = '123456789';
    my $ical = <<EOF;
BEGIN:VCALENDAR
PRODID: -//xxx//yyy//EN
VERSION:2.0
BEGIN:VTIMEZONE
TZID:Custom
LAST-MODIFIED:20210127T134508Z
BEGIN:DAYLIGHT
TZNAME:CEST
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
DTSTART:19810329T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
END:DAYLIGHT
BEGIN:STANDARD
TZNAME:CET
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
DTSTART:19961027T030000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
UID:$eventId
DTSTAMP:20201226T180609
DTSTART;TZID=Custom:20100101T140000
DURATION:PT1H
RRULE:FREQ=MONTHLY;COUNT=48
SUMMARY:A summary
CLASS:PUBLIC
END:VEVENT
END:VCALENDAR
EOF

    my $event = $self->putandget_vevent($eventId,
        $ical, ['timeZone']);
    $self->assert_str_equals('Europe/Berlin', $event->{timeZone});
}
