Fix empty part-of-day logic (#3726)

Fixes #3727

---------

Co-authored-by: veeck <gitkraken@veeck.de>
This commit is contained in:
Veeck
2025-02-27 19:31:00 +01:00
committed by GitHub
parent 28bcee7de6
commit 4a398f03eb
7 changed files with 60 additions and 27 deletions

View File

@@ -7,9 +7,9 @@ describe("Compliments module", () => {
* @param {Array} complimentsArray The array of compliments.
* @returns {boolean} result
*/
const doTest = async (complimentsArray) => {
await helpers.getElement(".compliments");
const elem = await helpers.getElement(".module-content");
const doTest = async (complimentsArray, state = "visible") => {
await helpers.getElement(".compliments", state);
const elem = await helpers.getElement(".module-content", state);
expect(elem).not.toBeNull();
expect(complimentsArray).toContain(await elem.textContent());
return true;
@@ -34,6 +34,11 @@ describe("Compliments module", () => {
await helpers.startApplication("tests/configs/modules/compliments/compliments_parts_day.js", "01 Oct 2022 20:00:00 GMT");
await expect(doTest(["Hello There", "Good Evening", "Evening test"])).resolves.toBe(true);
});
it("doesnt show evening compliments during the day when the other parts of day are not set", async () => {
await helpers.startApplication("tests/configs/modules/compliments/compliments_evening.js", "01 Oct 2022 08:00:00 GMT");
await expect(doTest([""], "attached")).resolves.toBe(true);
});
});
describe("Feature date in compliments module", () => {