added new electron tests supporting date mocking (#2947)

first PR for #2942 

- added new electron tests for calendar which test new css classes from
https://github.com/MichMich/MagicMirror/pull/2939
- moved some compliments tests from `e2e` to `electron` because of date
mocking
- removed mock stuff from compliments module
This commit is contained in:
Karsten Hassel
2022-10-17 07:20:23 +02:00
committed by GitHub
parent fc59ed20e3
commit ad4dbd786a
9 changed files with 134 additions and 66 deletions

View File

@@ -21,8 +21,7 @@ Module.register("compliments", {
morningEndTime: 12,
afternoonStartTime: 12,
afternoonEndTime: 17,
random: true,
mockDate: null
random: true
},
lastIndexUsed: -1,
// Set currentweather from module
@@ -85,7 +84,7 @@ Module.register("compliments", {
*/
complimentArray: function () {
const hour = moment().hour();
const date = this.config.mockDate ? this.config.mockDate : moment().format("YYYY-MM-DD");
const date = moment().format("YYYY-MM-DD");
let compliments;
if (hour >= this.config.morningStartTime && hour < this.config.morningEndTime && this.config.compliments.hasOwnProperty("morning")) {