mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-23 21:50:24 +00:00
fixes #3267 AGAIN, correctly, add testcase add testcase for #3679 , broadcast clipping incorrectly I added a test module (tests/testNotification) to catch the notification and check the count. (one way to configure) i put this module in the tests folder, and added /tests to the server paths. (can't have a module in a nested folder, like tests/modules/xxx) but I have a problem. i can run the test config (MM_CONFIG_FILE), and the two modules work correctly, but in the spec runner, the calendar module times out on the broadcast test.. there is only local ics file access, no outside hosts I forced my system date to 1/1/24 (same as runner) and again the manual testcase works fine I added two test config.js,(configs/calendar) one works great (symbols) , one fails (broadcast test) I added additional delay in the calendarspec runner to try to debug the module, but it still not long enough.. no messages of trouble when I get into the browser.. BUT, this may be because of the log being turned off... (just thought of this) I created a special ICS (in mocks) that has 12 events, 1 for each month.. (so I can check clipping and broadcast) the US holidays one is sensitive to the current date, and I couldn't get it to work on 1/1/2024.. also, in general, is there a mechanism to run test:just_one_runner? waiting thru the electron test to get to one testcase.. ugh..
This commit is contained in:
164
tests/mocks/12_events.ics
Normal file
164
tests/mocks/12_events.ics
Normal file
@@ -0,0 +1,164 @@
|
||||
BEGIN:VCALENDAR
|
||||
VERSION:2.0
|
||||
PRODID:-//Calendar Labs//Calendar 1.0//EN
|
||||
CALSCALE:GREGORIAN
|
||||
METHOD:PUBLISH
|
||||
X-WR-CALNAME:US Holidays
|
||||
X-WR-TIMEZONE:Etc/GMT
|
||||
BEGIN:VEVENT
|
||||
SUMMARY:Start of Month 1
|
||||
DTSTART:20190101
|
||||
DTEND:20190101
|
||||
RRULE:FREQ=YEARLY;WKST=SU;INTERVAL=1
|
||||
LOCATION:United States
|
||||
DESCRIPTION:Visit https://calendarlabs.com/holidays/us/new-years-day.php to know more about New Year's Day. \n\n Like us on Facebook: http://fb.com/calendarlabs to get updates
|
||||
UID:5e52949sada28d231582470298@calendarlabs.com
|
||||
DTSTAMP:20200223T150458Z
|
||||
STATUS:CONFIRMED
|
||||
TRANSP:TRANSPARENT
|
||||
SEQUENCE:0
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
SUMMARY:Start of Month 2
|
||||
DTSTART:20190201
|
||||
DTEND:20190201
|
||||
RRULE:FREQ=YEARLY;WKST=SU;INTERVAL=1
|
||||
LOCATION:United States
|
||||
DESCRIPTION:Visit https://calendarlabs.com/holidays/us/new-years-day.php to know more about New Year's Day. \n\n Like us on Facebook: http://fb.com/calendarlabs to get updates
|
||||
UID:5e52949a2wds8d231582470298@calendarlabs.com
|
||||
DTSTAMP:20200223T150458Z
|
||||
STATUS:CONFIRMED
|
||||
TRANSP:TRANSPARENT
|
||||
SEQUENCE:0
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
SUMMARY:Start of Month 3
|
||||
DTSTART:20190301
|
||||
DTEND:20190301
|
||||
RRULE:FREQ=YEARLY;WKST=SU;INTERVAL=1
|
||||
LOCATION:United States
|
||||
DESCRIPTION:Visit https://calendarlabs.com/holidays/us/new-years-day.php to know more about New Year's Day. \n\n Like us on Facebook: http://fb.com/calendarlabs to get updates
|
||||
UID:5e52949a2SDD8d231582470298@calendarlabs.com
|
||||
DTSTAMP:20200223T150458Z
|
||||
STATUS:CONFIRMED
|
||||
TRANSP:TRANSPARENT
|
||||
SEQUENCE:0
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
SUMMARY:Start of Month 4
|
||||
DTSTART:20190401
|
||||
DTEND:20190401
|
||||
RRULE:FREQ=YEARLY;WKST=SU;INTERVAL=1
|
||||
LOCATION:United States
|
||||
DESCRIPTION:Visit https://calendarlabs.com/holidays/us/new-years-day.php to know more about New Year's Day. \n\n Like us on Facebook: http://fb.com/calendarlabs to get updates
|
||||
UID:5e52949a2SDD8d231582FDSFD470298@calendarlabs.com
|
||||
DTSTAMP:20200223T150458Z
|
||||
STATUS:CONFIRMED
|
||||
TRANSP:TRANSPARENT
|
||||
SEQUENCE:0
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
SUMMARY:Start of Month 5
|
||||
DTSTART:20190501
|
||||
DTEND:20190501
|
||||
RRULE:FREQ=YEARLY;WKST=SU;INTERVAL=1
|
||||
LOCATION:United States
|
||||
DESCRIPTION:Visit https://calendarlabs.com/holidays/us/new-years-day.php to know more about New Year's Day. \n\n Like us on Facebook: http://fb.com/calendarlabs to get updates
|
||||
UID:5e52949a2SDD8d2DD315824702598@calendarlabs.com
|
||||
DTSTAMP:20200223T150458Z
|
||||
STATUS:CONFIRMED
|
||||
TRANSP:TRANSPARENT
|
||||
SEQUENCE:0
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
SUMMARY:Start of Month 6
|
||||
DTSTART:20190601
|
||||
DTEND:20190601
|
||||
RRULE:FREQ=YEARLY;WKST=SU;INTERVAL=1
|
||||
LOCATION:United States
|
||||
DESCRIPTION:Visit https://calendarlabs.com/holidays/us/new-years-day.php to know more about New Year's Day. \n\n Like us on Facebook: http://fb.com/calendarlabs to get updates
|
||||
UID:5e52949a2SDD8d2DD31582470298@calendarlabs.com
|
||||
DTSTAMP:20200223T150458Z
|
||||
STATUS:CONFIRMED
|
||||
TRANSP:TRANSPARENT
|
||||
SEQUENCE:0
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
SUMMARY:Start of Month 7
|
||||
DTSTART:20190701
|
||||
DTEND:20190701
|
||||
RRULE:FREQ=YEARLY;WKST=SU;INTERVAL=1
|
||||
LOCATION:United States
|
||||
DESCRIPTION:Visit https://calendarlabs.com/holidays/us/new-years-day.php to know more about New Year's Day. \n\n Like us on Facebook: http://fb.com/calendarlabs to get updates
|
||||
UID:5e52942SDD8d2DD31582470298@calendarlabs.com
|
||||
DTSTAMP:20200223T150458Z
|
||||
STATUS:CONFIRMED
|
||||
TRANSP:TRANSPARENT
|
||||
SEQUENCE:0
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
SUMMARY:Start of Month 8
|
||||
DTSTART:20190801
|
||||
DTEND:20190801
|
||||
RRULE:FREQ=YEARLY;WKST=SU;INTERVAL=1
|
||||
LOCATION:United States
|
||||
DESCRIPTION:Visit https://calendarlabs.com/holidays/us/new-years-day.php to know more about New Year's Day. \n\n Like us on Facebook: http://fb.com/calendarlabs to get updates
|
||||
UID:5e52949a2SDD8d2DDt31582470298@calendarlabs.com
|
||||
DTSTAMP:20200223T150458Z
|
||||
STATUS:CONFIRMED
|
||||
TRANSP:TRANSPARENT
|
||||
SEQUENCE:0
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
SUMMARY:Start of Month 9
|
||||
DTSTART:20190901
|
||||
DTEND:20190901
|
||||
RRULE:FREQ=YEARLY;WKST=SU;INTERVAL=1
|
||||
LOCATION:United States
|
||||
DESCRIPTION:Visit https://calendarlabs.com/holidays/us/new-years-day.php to know more about New Year's Day. \n\n Like us on Facebook: http://fb.com/calendarlabs to get updates
|
||||
UID:5e529449a2SDD8d2DDt315824702798@calendarlabs.com
|
||||
DTSTAMP:20200223T150458Z
|
||||
STATUS:CONFIRMED
|
||||
TRANSP:TRANSPARENT
|
||||
SEQUENCE:0
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
SUMMARY:Start of Month 10
|
||||
DTSTART:20191001
|
||||
DTEND:20191001
|
||||
RRULE:FREQ=YEARLY;WKST=SU;INTERVAL=1
|
||||
LOCATION:United States
|
||||
DESCRIPTION:Visit https://calendarlabs.com/holidays/us/new-years-day.php to know more about New Year's Day. \n\n Like us on Facebook: http://fb.com/calendarlabs to get updates
|
||||
UID:5e529449a2SDD8d2DDt31582470298@calendarlabs.com
|
||||
DTSTAMP:20200223T150458Z
|
||||
STATUS:CONFIRMED
|
||||
TRANSP:TRANSPARENT
|
||||
SEQUENCE:0
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
SUMMARY:Start of Month 11
|
||||
DTSTART:20191101
|
||||
DTEND:20191101
|
||||
RRULE:FREQ=YEARLY;WKST=SU;INTERVAL=1
|
||||
LOCATION:United States
|
||||
DESCRIPTION:Visit https://calendarlabs.com/holidays/us/new-years-day.php to know more about New Year's Day. \n\n Like us on Facebook: http://fb.com/calendarlabs to get updates
|
||||
UID:5e5294449a2SDD8d2DDt31582470298@calendarlabs.com
|
||||
DTSTAMP:20200223T150458Z
|
||||
STATUS:CONFIRMED
|
||||
TRANSP:TRANSPARENT
|
||||
SEQUENCE:0
|
||||
END:VEVENT
|
||||
BEGIN:VEVENT
|
||||
SUMMARY:Start of Month 12
|
||||
DTSTART:20191201
|
||||
DTEND:20191201
|
||||
RRULE:FREQ=YEARLY;WKST=SU;INTERVAL=1
|
||||
LOCATION:United States
|
||||
DESCRIPTION:Visit https://calendarlabs.com/holidays/us/new-years-day.php to know more about New Year's Day. \n\n Like us on Facebook: http://fb.com/calendarlabs to get updates
|
||||
UID:5e5294a2SDD8d2DDt31582470298@calendarlabs.com
|
||||
DTSTAMP:20200223T150458Z
|
||||
STATUS:CONFIRMED
|
||||
TRANSP:TRANSPARENT
|
||||
SEQUENCE:0
|
||||
END:VEVENT
|
||||
END:VCALENDAR
|
59
tests/mocks/testNotification/testNotification.js
Normal file
59
tests/mocks/testNotification/testNotification.js
Normal file
@@ -0,0 +1,59 @@
|
||||
Module.register("testNotification", {
|
||||
defaults: {
|
||||
debug: false,
|
||||
match: {
|
||||
notificationID: "",
|
||||
matchtype: "count"
|
||||
//or
|
||||
// type: 'contents' // look for item in field of content
|
||||
}
|
||||
},
|
||||
count: 0,
|
||||
table: null,
|
||||
notificationReceived (notification, payload) {
|
||||
if (notification === this.config.match.notificationID) {
|
||||
if (this.config.match.matchtype === "count") {
|
||||
this.count = payload.length;
|
||||
if (this.count) {
|
||||
this.table = document.createElement("table");
|
||||
this.addTableRow(this.table, null, `${this.count}:elementCount`);
|
||||
if (this.config.debug) {
|
||||
payload.forEach((e, i) => {
|
||||
this.addTableRow(this.table, i, e.title);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this.updateDom();
|
||||
}
|
||||
}
|
||||
},
|
||||
maketd (row, info) {
|
||||
let td = document.createElement("td");
|
||||
row.appendChild(td);
|
||||
if (info !== null) {
|
||||
let colinfo = info.toString().split(":");
|
||||
if (colinfo.length === 2) td.className = colinfo[1];
|
||||
td.innerText = colinfo[0];
|
||||
}
|
||||
return td;
|
||||
},
|
||||
addTableRow (table, col1 = null, col2 = null, col3 = null) {
|
||||
let tableRow = document.createElement("tr");
|
||||
table.appendChild(tableRow);
|
||||
|
||||
let tablecol1 = this.maketd(tableRow, col1);
|
||||
let tablecol2 = this.maketd(tableRow, col2);
|
||||
let tablecol3 = this.maketd(tableRow, col3);
|
||||
|
||||
return tableRow;
|
||||
},
|
||||
getDom () {
|
||||
let wrapper = document.createElement("div");
|
||||
if (this.table) {
|
||||
wrapper.appendChild(this.table);
|
||||
}
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
});
|
Reference in New Issue
Block a user