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:
@@ -6,6 +6,7 @@ describe("Calendar module", () => {
|
||||
* @param {string} element css selector
|
||||
* @param {string} result expected number
|
||||
* @param {string} not reverse result
|
||||
* @returns {boolean} result
|
||||
*/
|
||||
const testElementLength = async (element, result, not) => {
|
||||
const elem = await helpers.waitForAllElements(element);
|
||||
@@ -15,12 +16,14 @@ describe("Calendar module", () => {
|
||||
} else {
|
||||
expect(elem).toHaveLength(result);
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
const testTextContain = async (element, text) => {
|
||||
const elem = await helpers.waitForElement(element, "undefinedLoading");
|
||||
expect(elem).not.toBeNull();
|
||||
expect(elem.textContent).toContain(text);
|
||||
return true;
|
||||
};
|
||||
|
||||
afterAll(async () => {
|
||||
@@ -34,11 +37,11 @@ describe("Calendar module", () => {
|
||||
});
|
||||
|
||||
it("should show the default maximumEntries of 10", async () => {
|
||||
await testElementLength(".calendar .event", 10);
|
||||
await expect(testElementLength(".calendar .event", 10)).resolves.toBe(true);
|
||||
});
|
||||
|
||||
it("should show the default calendar symbol in each event", async () => {
|
||||
await testElementLength(".calendar .event .fa-calendar-alt", 0, "not");
|
||||
await expect(testElementLength(".calendar .event .fa-calendar-alt", 0, "not")).resolves.toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -49,27 +52,27 @@ describe("Calendar module", () => {
|
||||
});
|
||||
|
||||
it("should show the custom maximumEntries of 5", async () => {
|
||||
await testElementLength(".calendar .event", 5);
|
||||
await expect(testElementLength(".calendar .event", 5)).resolves.toBe(true);
|
||||
});
|
||||
|
||||
it("should show the custom calendar symbol in four events", async () => {
|
||||
await testElementLength(".calendar .event .fa-birthday-cake", 4);
|
||||
await expect(testElementLength(".calendar .event .fa-birthday-cake", 4)).resolves.toBe(true);
|
||||
});
|
||||
|
||||
it("should show a customEvent calendar symbol in one event", async () => {
|
||||
await testElementLength(".calendar .event .fa-dice", 1);
|
||||
await expect(testElementLength(".calendar .event .fa-dice", 1)).resolves.toBe(true);
|
||||
});
|
||||
|
||||
it("should show a customEvent calendar eventClass in one event", async () => {
|
||||
await testElementLength(".calendar .event.undo", 1);
|
||||
await expect(testElementLength(".calendar .event.undo", 1)).resolves.toBe(true);
|
||||
});
|
||||
|
||||
it("should show two custom icons for repeating events", async () => {
|
||||
await testElementLength(".calendar .event .fa-undo", 2);
|
||||
await expect(testElementLength(".calendar .event .fa-undo", 2)).resolves.toBe(true);
|
||||
});
|
||||
|
||||
it("should show two custom icons for day events", async () => {
|
||||
await testElementLength(".calendar .event .fa-calendar-day", 2);
|
||||
await expect(testElementLength(".calendar .event .fa-calendar-day", 2)).resolves.toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -80,7 +83,7 @@ describe("Calendar module", () => {
|
||||
});
|
||||
|
||||
it("should show the recurring birthday event 6 times", async () => {
|
||||
await testElementLength(".calendar .event", 6);
|
||||
await expect(testElementLength(".calendar .event", 6)).resolves.toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -91,7 +94,7 @@ describe("Calendar module", () => {
|
||||
});
|
||||
|
||||
it("should show the recurring event 51 times (excluded once) in a 364-day (inclusive) period", async () => {
|
||||
await testElementLength(".calendar .event", 51);
|
||||
await expect(testElementLength(".calendar .event", 51)).resolves.toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -102,7 +105,7 @@ describe("Calendar module", () => {
|
||||
});
|
||||
|
||||
it("should show multiple events with the same title and start time from different calendars", async () => {
|
||||
await testElementLength(".calendar .event", 22);
|
||||
await expect(testElementLength(".calendar .event", 22)).resolves.toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -118,7 +121,7 @@ describe("Calendar module", () => {
|
||||
});
|
||||
|
||||
it(`should contain text "Mar 25th" in timezone UTC ${-i}`, async () => {
|
||||
await testTextContain(".calendar", "Mar 25th");
|
||||
await expect(testTextContain(".calendar", "Mar 25th")).resolves.toBe(true);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -135,7 +138,7 @@ describe("Calendar module", () => {
|
||||
});
|
||||
|
||||
it("should return TestEvents", async () => {
|
||||
await testElementLength(".calendar .event", 0, "not");
|
||||
await expect(testElementLength(".calendar .event", 0, "not")).resolves.toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -146,7 +149,7 @@ describe("Calendar module", () => {
|
||||
});
|
||||
|
||||
it("should return TestEvents", async () => {
|
||||
await testElementLength(".calendar .event", 0, "not");
|
||||
await expect(testElementLength(".calendar .event", 0, "not")).resolves.toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -157,7 +160,7 @@ describe("Calendar module", () => {
|
||||
});
|
||||
|
||||
it("should return TestEvents", async () => {
|
||||
await testElementLength(".calendar .event", 0, "not");
|
||||
await expect(testElementLength(".calendar .event", 0, "not")).resolves.toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -168,7 +171,7 @@ describe("Calendar module", () => {
|
||||
});
|
||||
|
||||
it("should return TestEvents", async () => {
|
||||
await testElementLength(".calendar .event", 0, "not");
|
||||
await expect(testElementLength(".calendar .event", 0, "not")).resolves.toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -184,7 +187,7 @@ describe("Calendar module", () => {
|
||||
});
|
||||
|
||||
it("should show Unauthorized error", async () => {
|
||||
await testTextContain(".calendar", "Error in the calendar module. Authorization failed");
|
||||
await expect(testTextContain(".calendar", "Error in the calendar module. Authorization failed")).resolves.toBe(true);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user