2026-02-09 20:35:54 +01:00
|
|
|
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();
|
|
|
|
|
});
|
|
|
|
|
|
2026-02-25 10:55:56 +01:00
|
|
|
it("config.language should be \"de\"", () => {
|
2026-02-09 20:35:54 +01:00
|
|
|
expect(config.language).toBe("de");
|
|
|
|
|
});
|
|
|
|
|
|
2026-02-25 10:55:56 +01:00
|
|
|
it("config.loglevel should be [\"ERROR\", \"LOG\", \"WARN\", \"INFO\"]", () => {
|
2026-02-09 20:35:54 +01:00
|
|
|
expect(config.logLevel).toStrictEqual(["ERROR", "LOG", "WARN", "INFO"]);
|
|
|
|
|
});
|
|
|
|
|
|
2026-02-25 10:55:56 +01:00
|
|
|
it("config.ipWhitelist should be [\"::ffff:127.0.0.1\", \"::1\", \"127.0.0.1\"]", () => {
|
2026-02-09 20:35:54 +01:00
|
|
|
expect(config.ipWhitelist).toStrictEqual(["::ffff:127.0.0.1", "::1", "127.0.0.1"]);
|
|
|
|
|
});
|
|
|
|
|
|
2026-02-25 10:55:56 +01:00
|
|
|
it("config.timeFormat should be 12", () => {
|
2026-02-09 20:35:54 +01:00
|
|
|
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**"]);
|
|
|
|
|
});
|
|
|
|
|
});
|