mirror of
https://github.com/MichMich/MagicMirror.git
synced 2026-06-24 17:27:44 -07:00
13d51cfce9
Small cleanup PR to close three CodeQL alerts, without changing app behavior. - [#18](https://github.com/MagicMirrorOrg/MagicMirror/security/code-scanning/18) in `js/loader.js` - [#19](https://github.com/MagicMirrorOrg/MagicMirror/security/code-scanning/19) in `js/socketclient.js` - [#20](https://github.com/MagicMirrorOrg/MagicMirror/security/code-scanning/20) in `tests/electron/modules/calendar_spec.js` For `Loader` and `MMSocket`, make the global export explicit via `globalThis` (instead of suppressing `no-unused-vars`). For calendar tests, remove the unused debug helper `logAllText`. Also includes a tiny e2e cleanup: `MM_PORT` is cleared in `afterAll`. Outcome: Three open CodeQL alerts are addressed with small, low-risk changes. The global intent for `Loader` and `MMSocket` is explicit, dead test helper code is removed, and e2e test state is cleaned up more reliably between runs. With this, all current [code scanning issues](https://github.com/MagicMirrorOrg/MagicMirror/security/code-scanning) should be resolved in the develop branch 🎈
37 lines
945 B
JavaScript
37 lines
945 B
JavaScript
const helpers = require("./helpers/global-setup");
|
|
|
|
describe("port directive configuration", () => {
|
|
describe("Set port 8090", () => {
|
|
beforeAll(async () => {
|
|
await helpers.startApplication("tests/configs/port_8090.js");
|
|
});
|
|
|
|
afterAll(async () => {
|
|
await helpers.stopApplication();
|
|
});
|
|
|
|
it("should return 200", async () => {
|
|
const res = await fetch(`http://localhost:${global.testPort}`);
|
|
expect(res.status).toBe(200);
|
|
});
|
|
});
|
|
|
|
describe("Set port 8100 on environment variable MM_PORT", () => {
|
|
beforeAll(async () => {
|
|
process.env.MM_PORT = "8100";
|
|
await helpers.startApplication("tests/configs/port_8090.js");
|
|
});
|
|
|
|
afterAll(async () => {
|
|
await helpers.stopApplication();
|
|
delete process.env.MM_PORT;
|
|
});
|
|
|
|
it("should return 200", async () => {
|
|
expect(global.testPort).toBe(8100);
|
|
const res = await fetch(`http://localhost:${global.testPort}`);
|
|
expect(res.status).toBe(200);
|
|
});
|
|
});
|
|
});
|