mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 03:39:55 +00:00
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? 🙂
38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
const events = require("events");
|
|
const helpers = require("./helpers/global-setup");
|
|
|
|
describe("Electron app environment", () => {
|
|
beforeEach(async () => {
|
|
await helpers.startApplication("tests/configs/modules/display.js");
|
|
});
|
|
|
|
afterEach(async () => {
|
|
await helpers.stopApplication();
|
|
});
|
|
|
|
it("should open browserwindow", async () => {
|
|
const module = await helpers.getElement("#module_0_helloworld");
|
|
await expect(module.textContent()).resolves.toContain("Test Display Header");
|
|
expect(global.electronApp.windows()).toHaveLength(1);
|
|
});
|
|
});
|
|
|
|
describe("Development console tests", () => {
|
|
beforeEach(async () => {
|
|
await helpers.startApplication("tests/configs/modules/display.js", null, ["js/electron.js", "dev"]);
|
|
});
|
|
|
|
afterEach(async () => {
|
|
await helpers.stopApplication();
|
|
});
|
|
|
|
it("should open browserwindow and dev console", async () => {
|
|
while (global.electronApp.windows().length < 2) await events.once(global.electronApp, "window");
|
|
const pageArray = await global.electronApp.windows();
|
|
expect(pageArray).toHaveLength(2);
|
|
for (const page of pageArray) {
|
|
expect(["MagicMirror²", "DevTools"]).toContain(await page.title());
|
|
}
|
|
});
|
|
});
|