mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-23 13:24:06 +00:00
Update compliments with support for cron type date/time for selections, addition to just date. (#3481)
> - What does the pull request accomplish? Use a list if needed. this change allows uses to configure date/time events for compliments.. also linked site that will build the cron entry.. and example was Happy hour in a pub, on fri/sat between 5 and 7 pm. or just after midnight on Halloween (Boooooo!) I also added testcases for #3478 (and added support for this in MMM-Config), with a custom, drop down selection list of the types.. ) | if this is approved I will update the module doc
This commit is contained in:
18
tests/configs/modules/compliments/compliments_cron_entry.js
Normal file
18
tests/configs/modules/compliments/compliments_cron_entry.js
Normal file
@@ -0,0 +1,18 @@
|
||||
let config = {
|
||||
modules: [
|
||||
{
|
||||
module: "compliments",
|
||||
position: "middle_center",
|
||||
config: {
|
||||
specialDayUnique: true,
|
||||
compliments: {
|
||||
anytime: ["just a test"],
|
||||
"00-10 16-19 * * fri": ["just pub time"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") { module.exports = config; }
|
@@ -0,0 +1,18 @@
|
||||
let config = {
|
||||
modules: [
|
||||
{
|
||||
module: "compliments",
|
||||
position: "middle_center",
|
||||
config: {
|
||||
specialDayUnique: true,
|
||||
compliments: {
|
||||
anytime: ["just a test"],
|
||||
"* * * * *": ["anytime cron"]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
/*************** DO NOT EDIT THE LINE BELOW ***************/
|
||||
if (typeof module !== "undefined") { module.exports = config; }
|
@@ -77,5 +77,16 @@ describe("Compliments module", () => {
|
||||
await expect(doTest(["Special day message"])).resolves.toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("cron type key", () => {
|
||||
beforeAll(async () => {
|
||||
await helpers.startApplication("tests/configs/modules/compliments/compliments_e2e_cron_entry.js");
|
||||
await helpers.getDocument();
|
||||
});
|
||||
|
||||
it("compliments array contains only special value", async () => {
|
||||
await expect(doTest(["anytime cron"])).resolves.toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@@ -43,5 +43,41 @@ describe("Compliments module", () => {
|
||||
await expect(doTest(["Happy new year!"])).resolves.toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Test only custom date events shown with new property", () => {
|
||||
it("shows 'Special day message' on May 6", async () => {
|
||||
await helpers.startApplication("tests/configs/modules/compliments/compliments_specialDayUnique_true.js", "06 May 2022 10:00:00 GMT");
|
||||
await expect(doTest(["Special day message"])).resolves.toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Test all date events shown without neww property", () => {
|
||||
it("shows 'any message' on May 6", async () => {
|
||||
await helpers.startApplication("tests/configs/modules/compliments/compliments_specialDayUnique_false.js", "06 May 2022 10:00:00 GMT");
|
||||
await expect(doTest(["Special day message", "Typical message 1", "Typical message 2", "Typical message 3"])).resolves.toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Test only custom cron date event shown with new property", () => {
|
||||
it("shows 'any message' on May 6", async () => {
|
||||
await helpers.startApplication("tests/configs/modules/compliments/compliments_cron_entry.js", "06 May 2022 17:03:00 GMT");
|
||||
await expect(doTest(["just pub time"])).resolves.toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Test any event shows after time window", () => {
|
||||
it("shows 'any message' on May 6", async () => {
|
||||
await helpers.startApplication("tests/configs/modules/compliments/compliments_cron_entry.js", "06 May 2022 17:11:00 GMT");
|
||||
await expect(doTest(["just a test"])).resolves.toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Test any event shows different day", () => {
|
||||
it("shows 'any message' on May 5", async () => {
|
||||
await helpers.startApplication("tests/configs/modules/compliments/compliments_cron_entry.js", "05 May 2022 17:00:00 GMT");
|
||||
await expect(doTest(["just a test"])).resolves.toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user