test(config): cover bind alias legacy detection and log escaping

This commit is contained in:
Vincent Koc
2026-03-01 19:36:51 -08:00
parent a5c27ce142
commit ec3a672e6e

View File

@@ -402,6 +402,25 @@ describe("legacy config detection", () => {
}
}
});
it("flags gateway.bind host aliases as legacy to trigger auto-migration paths", async () => {
const cases = ["0.0.0.0", "::", "127.0.0.1", "localhost", "::1"] as const;
for (const bind of cases) {
const validated = validateConfigObject({ gateway: { bind } });
expect(validated.ok, bind).toBe(false);
if (!validated.ok) {
expect(
validated.issues.some((issue) => issue.path === "gateway.bind"),
bind,
).toBe(true);
}
}
});
it("escapes control characters in gateway.bind migration change text", async () => {
const res = migrateLegacyConfig({
gateway: { bind: "\r\n0.0.0.0\r\n" },
});
expect(res.changes).toContain('Normalized gateway.bind "\\r\\n0.0.0.0\\r\\n" → "lan".');
});
it('enforces dmPolicy="open" allowFrom wildcard for supported providers', async () => {
const cases = [
{