Enable and apply ESLint Jest rules (#3270)

Jest was in the plugin array of the ESLint configuration, but no rules
were enabled. So ESLint hasn't checked any Jest rules yet.

So I activated the recommended Jest rules and added a few more. Then I
fixed the issues (mostly automatically). I have deactivated the rules
"jest/expect-expect" and "jest/no-done-callback" for the time being, as
they would have entailed major changes. I didn't want to make the PR too
big.

I'm not a Jest expert, but the changes so far look good to me. What do
you think of that @khassel? 🙂
This commit is contained in:
Kristjan ESPERANTO
2023-11-20 20:11:41 +01:00
committed by GitHub
parent 679a413788
commit 7098f1e41f
32 changed files with 113 additions and 105 deletions

View File

@@ -72,7 +72,7 @@ describe("Clock module", () => {
it("should not show the time when digital clock is shown", async () => {
const elem = document.querySelector(".clock .digital .time");
expect(elem).toBe(null);
expect(elem).toBeNull();
});
});
@@ -84,12 +84,12 @@ describe("Clock module", () => {
it("should show the sun times", async () => {
const elem = await helpers.waitForElement(".clock .digital .sun");
expect(elem).not.toBe(null);
expect(elem).not.toBeNull();
});
it("should show the moon times", async () => {
const elem = await helpers.waitForElement(".clock .digital .moon");
expect(elem).not.toBe(null);
expect(elem).not.toBeNull();
});
});
@@ -108,7 +108,7 @@ describe("Clock module", () => {
const currentWeekNumber = moment().week();
const weekToShow = `Week ${currentWeekNumber}`;
const elem = await helpers.waitForElement(".clock .week");
expect(elem).not.toBe(null);
expect(elem).not.toBeNull();
expect(elem.textContent).toBe(weekToShow);
});
});
@@ -121,7 +121,7 @@ describe("Clock module", () => {
it("should show the analog clock face", async () => {
const elem = helpers.waitForElement(".clock-circle");
expect(elem).not.toBe(null);
expect(elem).not.toBeNull();
});
});
@@ -133,9 +133,9 @@ describe("Clock module", () => {
it("should show the analog clock face and the date", async () => {
const elemClock = helpers.waitForElement(".clock-circle");
await expect(elemClock).not.toBe(null);
await expect(elemClock).not.toBeNull();
const elemDate = helpers.waitForElement(".clock .date");
await expect(elemDate).not.toBe(null);
await expect(elemDate).not.toBeNull();
});
});
});