-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Fixes: #3256 BUT.. the testcase is inconclusive.. as the code FAILS without the fix, BUT somehow RETURNS 0 entries.. in real life run the node helper fails, and all calendar processing stops.
- Loading branch information
Showing
5 changed files
with
82 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* MagicMirror² Test ics with out of date event causing bad return from rrule.between | ||
* | ||
* By Sam Detweiler | ||
* MIT Licensed. | ||
*/ | ||
let config = { | ||
timeFormat: 12, | ||
logLevel: ["INFO", "LOG", "WARN", "ERROR", "DEBUG"], | ||
modules: [ | ||
{ | ||
module: "calendar", | ||
position: "bottom_bar", | ||
config: { | ||
calendars: [ | ||
{ | ||
url: "http://localhost:8080/tests/mocks/bad_rrule.ics" | ||
} | ||
] | ||
} | ||
} | ||
] | ||
}; | ||
|
||
/*************** DO NOT EDIT THE LINE BELOW ***************/ | ||
if (typeof module !== "undefined") { | ||
module.exports = config; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
BEGIN:VCALENDAR | ||
BEGIN:VEVENT | ||
DTSTAMP:20210413T203456Z | ||
UID:E689AEB8C02C4E2CADD8C7D3D303CEAD0 | ||
DTSTART;TZID="Amsterdam, Belgrade, Berlin, Brussels, Budapest, Madrid, Paris, Prague, Stockholm":20210415T190000 | ||
DTEND;TZID="Amsterdam, Belgrade, Berlin, Brussels, Budapest, Madrid, Paris, Prague, Stockholm":20210415T210000 | ||
CLASS:PUBLIC | ||
LOCATION:albert heijn | ||
SUMMARY:xxx xxxx | ||
SEQUENCE:10 | ||
RRULE:FREQ=DAILY;UNTIL=20210418T170000Z | ||
EXDATE;TZID="Amsterdam, Belgrade, Berlin, Brussels, Budapest, Madrid, Paris, Prague, Stockholm":20210417T190000 | ||
EXDATE;TZID="Amsterdam, Belgrade, Berlin, Brussels, Budapest, Madrid, Paris, Prague, Stockholm":20210416T190000 | ||
EXDATE;TZID="Amsterdam, Belgrade, Berlin, Brussels, Budapest, Madrid, Paris, Prague, Stockholm":20210415T190000 | ||
BEGIN:VALARM | ||
ACTION:DISPLAY | ||
TRIGGER;RELATED=START:-PT15M | ||
END:VALARM | ||
END:VEVENT | ||
END:VCALENDAR |
29 changes: 29 additions & 0 deletions
29
tests/unit/modules/default/calendar/calendar_fetcher_utils_bad_rrule.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
global.moment = require("moment-timezone"); | ||
|
||
const CalendarFetcherUtils = require("../../../../../modules/default/calendar/calendarfetcherutils"); | ||
|
||
describe("Calendar fetcher utils test", () => { | ||
const defaultConfig = { | ||
excludedEvents: [] | ||
}; | ||
|
||
describe("filterEvents", () => { | ||
it("no events, not crash", () => { | ||
const minusOneHour = moment().subtract(1, "hours").toDate(); | ||
const minusTwoHours = moment().subtract(2, "hours").toDate(); | ||
const plusOneHour = moment().add(1, "hours").toDate(); | ||
const plusTwoHours = moment().add(2, "hours").toDate(); | ||
|
||
const filteredEvents = CalendarFetcherUtils.filterEvents( | ||
{ | ||
pastEvent: { type: "VEVENT", start: minusTwoHours, end: minusOneHour, summary: "pastEvent" }, | ||
ongoingEvent: { type: "VEVENT", start: minusOneHour, end: plusOneHour, summary: "ongoingEvent" }, | ||
upcomingEvent: { type: "VEVENT", start: plusOneHour, end: plusTwoHours, summary: "upcomingEvent" } | ||
}, | ||
defaultConfig | ||
); | ||
|
||
expect(filteredEvents.length).toEqual(0); | ||
}); | ||
}); | ||
}); |