mirror of
https://github.com/MichMich/MagicMirror.git
synced 2026-04-25 23:32:10 +00:00
Enable the `require-await` ESLint rule. Async functions without `await` are just regular functions with extra overhead — marking them `async` adds implicit Promise wrapping, can hide missing `return` statements, and misleads readers into expecting asynchronous behavior where there is none. While fixing the violations, I removed unnecessary `async` keywords from source files and from various test callbacks that never used `await`.
35 lines
1.1 KiB
JavaScript
35 lines
1.1 KiB
JavaScript
const helpers = require("./helpers/global-setup");
|
|
|
|
describe("config with variables and secrets", () => {
|
|
beforeAll(async () => {
|
|
await helpers.startApplication("tests/configs/config_variables.js");
|
|
});
|
|
|
|
afterAll(async () => {
|
|
await helpers.stopApplication();
|
|
});
|
|
|
|
it("config.language should be \"de\"", () => {
|
|
expect(config.language).toBe("de");
|
|
});
|
|
|
|
it("config.loglevel should be [\"ERROR\", \"LOG\", \"WARN\", \"INFO\"]", () => {
|
|
expect(config.logLevel).toStrictEqual(["ERROR", "LOG", "WARN", "INFO"]);
|
|
});
|
|
|
|
it("config.ipWhitelist should be [\"::ffff:127.0.0.1\", \"::1\", \"127.0.0.1\"]", () => {
|
|
expect(config.ipWhitelist).toStrictEqual(["::ffff:127.0.0.1", "::1", "127.0.0.1"]);
|
|
});
|
|
|
|
it("config.timeFormat should be 12", () => {
|
|
expect(config.timeFormat).toBe(12); // default is 24
|
|
});
|
|
|
|
it("/config endpoint should show redacted secrets", async () => {
|
|
const res = await fetch(`http://localhost:${config.port}/config`);
|
|
expect(res.status).toBe(200);
|
|
const cfg = await res.json();
|
|
expect(cfg.ipWhitelist).toStrictEqual(["**SECRET_IP2**", "::**SECRET_IP3**", "**SECRET_IP1**"]);
|
|
});
|
|
});
|