Skip to content

Commit

Permalink
Add tests to cover timezones with DTSTART in utc and RRULEs with UNTIL
Browse files Browse the repository at this point in the history
  • Loading branch information
kewisch committed May 21, 2015
1 parent dc1831d commit 27b1656
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 4 deletions.
26 changes: 26 additions & 0 deletions samples/timezones/Makebelieve/RDATE_utc_test.ics
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
BEGIN:VCALENDAR
PRODID:-//ical.js//NONSGML Makebelieve//EN
VERSION:2.0
BEGIN:VTIMEZONE
TZID:Makebelieve/RDATE_as_date_utc
X-LIC-LOCATION:Makebelieve/RDATE_as_date_utc
BEGIN:STANDARD
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
TZNAME:RDATE_as_date_utc_standard
DTSTART:19700101T020000Z
RDATE:19700101T020000
RDATE;VALUE=DATE:19800101
RDATE:19900101T070000Z
END:STANDARD
BEGIN:DAYLIGHT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
TZNAME:RDATE_as_date_utc_daylight
DTSTART:19750101T020000Z
RDATE:19750101T020000
RDATE;VALUE=DATE:19850101
RDATE:19950101T070000Z
END:DAYLIGHT
END:VTIMEZONE
END:VCALENDAR
22 changes: 22 additions & 0 deletions samples/timezones/Makebelieve/RRULE_UNTIL_test.ics
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
BEGIN:VCALENDAR
PRODID:-//ical.js//NONSGML Makebelieve//EN
VERSION:2.0
BEGIN:VTIMEZONE
TZID:Makebelieve/RRULE_UNTIL
X-LIC-LOCATION:Makebelieve/RRULE_UNTIL
BEGIN:STANDARD
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
TZNAME:RRULE_UNTIL_standard
DTSTART:19700101T020000Z
RRULE:FREQ=YEARLY;INTERVAL=5;UNTIL=19800101T020000Z
END:STANDARD
BEGIN:DAYLIGHT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
TZNAME:RDATE_UNTIL_daylight
DTSTART:19750101T020000
RRULE:FREQ=YEARLY;INTERVAL=5;UNTIL=19850101T020000Z
END:DAYLIGHT
END:VTIMEZONE
END:VCALENDAR
35 changes: 31 additions & 4 deletions test/timezone_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,17 @@ suite('timezone', function() {
// just before DST
time: { year: 1980, month: 1, day: 1, hour: 0, minute: 59 },
offsets: {
'Makebelieve/RDATE_test': -4
'Makebelieve/RDATE_test': -4,
'Makebelieve/RDATE_utc_test': -5
}
},

{
// just after DST
time: { year: 1980, month: 1, day: 1, hour: 1 },
offsets: {
'Makebelieve/RDATE_test': -5
'Makebelieve/RDATE_test': -5,
'Makebelieve/RDATE_utc_test': -5
}
},

Expand All @@ -108,15 +110,40 @@ suite('timezone', function() {
// just before DST
time: { year: 1990, month: 1, day: 1, hour: 0, minute: 59 },
offsets: {
'Makebelieve/RDATE_test': -4
'Makebelieve/RDATE_test': -4,
'Makebelieve/RDATE_utc_test': -4
}
},

{
// just after DST
time: { year: 1990, month: 1, day: 1, hour: 2 },
offsets: {
'Makebelieve/RDATE_test': -5
'Makebelieve/RDATE_test': -5,
'Makebelieve/RDATE_utc_test': -5
}
},

// Edge case timezone where an RRULE with UNTIL in UTC is specified
{
// Just before DST
time: { year: 1975, month: 1, day: 1, hour: 1, minute: 0, second: 0 },
offsets: {
'Makebelieve/RRULE_UNTIL_test': -5
}
},
{
// Just after DST
time: { year: 1975, month: 1, day: 1, hour: 3, minute: 0, second: 0 },
offsets: {
'Makebelieve/RRULE_UNTIL_test': -4
}
},
{
// After the RRULE ends
time: { year: 1985, month: 1, day: 1, hour: 3, minute: 0, second: 0 },
offsets: {
'Makebelieve/RRULE_UNTIL_test': -4
}
}
];
Expand Down

0 comments on commit 27b1656

Please sign in to comment.