mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-08-21 12:55:22 +00:00
enable eslint jest/expect-expect and jest/no-done-callback (#3272)
follow up to https://github.com/MichMich/MagicMirror/pull/3270
This commit is contained in:
@@ -4,12 +4,14 @@ describe("Compliments module", () => {
|
||||
/**
|
||||
* move similar tests in function doTest
|
||||
* @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");
|
||||
expect(elem).not.toBeNull();
|
||||
expect(complimentsArray).toContain(await elem.textContent());
|
||||
return true;
|
||||
};
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -19,17 +21,17 @@ describe("Compliments module", () => {
|
||||
describe("parts of days", () => {
|
||||
it("Morning compliments for that part of day", async () => {
|
||||
await helpers.startApplication("tests/configs/modules/compliments/compliments_parts_day.js", "01 Oct 2022 10:00:00 GMT");
|
||||
await doTest(["Hi", "Good Morning", "Morning test"]);
|
||||
await expect(doTest(["Hi", "Good Morning", "Morning test"])).resolves.toBe(true);
|
||||
});
|
||||
|
||||
it("Afternoon show Compliments for that part of day", async () => {
|
||||
await helpers.startApplication("tests/configs/modules/compliments/compliments_parts_day.js", "01 Oct 2022 15:00:00 GMT");
|
||||
await doTest(["Hello", "Good Afternoon", "Afternoon test"]);
|
||||
await expect(doTest(["Hello", "Good Afternoon", "Afternoon test"])).resolves.toBe(true);
|
||||
});
|
||||
|
||||
it("Evening show Compliments for that part of day", async () => {
|
||||
await helpers.startApplication("tests/configs/modules/compliments/compliments_parts_day.js", "01 Oct 2022 20:00:00 GMT");
|
||||
await doTest(["Hello There", "Good Evening", "Evening test"]);
|
||||
await expect(doTest(["Hello There", "Good Evening", "Evening test"])).resolves.toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -37,7 +39,7 @@ describe("Compliments module", () => {
|
||||
describe("Set date and empty compliments for anytime, morning, evening and afternoon", () => {
|
||||
it("shows happy new year compliment on new years day", async () => {
|
||||
await helpers.startApplication("tests/configs/modules/compliments/compliments_date.js", "01 Jan 2022 10:00:00 GMT");
|
||||
await doTest(["Happy new year!"]);
|
||||
await expect(doTest(["Happy new year!"])).resolves.toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user