mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-25 23:55:07 +00:00
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.
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user