Add tests for custom icons

This commit is contained in:
rejas 2020-07-19 11:54:03 +02:00
parent 8fa858ca8c
commit 50f3f32ba8
3 changed files with 75 additions and 5 deletions

View File

@ -0,0 +1,56 @@
BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//ical.marudot.com//iCal Event Maker
X-WR-CALNAME:TestEvents
NAME:TestEvents
CALSCALE:GREGORIAN
BEGIN:VTIMEZONE
TZID:Europe/Berlin
TZURL:http://tzurl.org/zoneinfo-outlook/Europe/Berlin
X-LIC-LOCATION:Europe/Berlin
BEGIN:DAYLIGHT
TZOFFSETFROM:+0100
TZOFFSETTO:+0200
TZNAME:CEST
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:+0200
TZOFFSETTO:+0100
TZNAME:CET
DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
DTSTAMP:20200719T094531Z
UID:20200719T094531Z-1871115387@marudot.com
DTSTART;TZID=Europe/Berlin:20300101T120000
DTEND;TZID=Europe/Berlin:20300101T130000
SUMMARY:TestEvent
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20200719T094531Z
UID:20200719T094531Z-1929725136@marudot.com
DTSTART;TZID=Europe/Berlin:20300701T120000
RRULE:FREQ=YEARLY;BYMONTH=7;BYMONTHDAY=1
DTEND;TZID=Europe/Berlin:20300701T130000
SUMMARY:TestEventRepeat
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20200719T094531Z
UID:20200719T094531Z-371801474@marudot.com
DTSTART;VALUE=DATE:20300401
DTEND;VALUE=DATE:20300402
SUMMARY:TestEventDay
END:VEVENT
BEGIN:VEVENT
DTSTAMP:20200719T094531Z
UID:20200719T094531Z-133401084@marudot.com
DTSTART;VALUE=DATE:20301001
RRULE:FREQ=YEARLY;BYMONTH=10;BYMONTHDAY=1
DTEND;VALUE=DATE:20301002
SUMMARY:TestEventRepeatDay
END:VEVENT
END:VCALENDAR

View File

@ -23,9 +23,11 @@ let config = {
calendars: [ calendars: [
{ {
symbol: "birthday-cake", symbol: "birthday-cake",
maximumEntries: 3, fullDaySymbol: "calendar-day",
recurringSymbol: "undo",
maximumEntries: 4,
maximumNumberOfDays: 10000, maximumNumberOfDays: 10000,
url: "http://localhost:8080/tests/configs/data/calendar_test.ics" url: "http://localhost:8080/tests/configs/data/calendar_test_icons.ics"
} }
] ]
} }

View File

@ -51,16 +51,28 @@ describe("Calendar module", function () {
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/custom.js"; process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/custom.js";
}); });
it("should show the custom maximumEntries of 3", async () => { it("should show the custom maximumEntries of 4", async () => {
await app.client.waitUntilTextExists(".calendar", "TestEvent", 10000); await app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
const events = await app.client.$$(".calendar .event"); const events = await app.client.$$(".calendar .event");
return expect(events.length).equals(3); return expect(events.length).equals(4);
}); });
it("should show the custom calendar symbol in each event", async () => { it("should show the custom calendar symbol in each event", async () => {
await app.client.waitUntilTextExists(".calendar", "TestEvent", 10000); await app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
const icons = await app.client.$$(".calendar .event .fa-birthday-cake"); const icons = await app.client.$$(".calendar .event .fa-birthday-cake");
return expect(icons.length).not.equals(0); return expect(icons.length).equals(4);
});
it("should show two custom icons for repeating events", async () => {
await app.client.waitUntilTextExists(".calendar", "TestEventRepeat", 10000);
const icons = await app.client.$$(".calendar .event .fa-undo");
return expect(icons.length).equals(2);
});
it("should show two custom icons for day events", async () => {
await app.client.waitUntilTextExists(".calendar", "TestEventDay", 10000);
const icons = await app.client.$$(".calendar .event .fa-calendar-day");
return expect(icons.length).equals(2);
}); });
}); });