From 0f5348acb207a78f7f502fcad051320eebc6528d Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 1 Mar 2026 23:08:26 +0000 Subject: [PATCH] test(config): reject discord open DM with empty allowFrom --- src/config/config.dm-policy-alias.test.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/config/config.dm-policy-alias.test.ts b/src/config/config.dm-policy-alias.test.ts index cc07614e9..03f49f6d7 100644 --- a/src/config/config.dm-policy-alias.test.ts +++ b/src/config/config.dm-policy-alias.test.ts @@ -12,6 +12,26 @@ describe("DM policy aliases (Slack/Discord)", () => { } }); + it('rejects discord dmPolicy="open" with empty allowFrom', () => { + const res = validateConfigObject({ + channels: { discord: { dmPolicy: "open", allowFrom: [] } }, + }); + expect(res.ok).toBe(false); + if (!res.ok) { + expect(res.issues[0]?.path).toBe("channels.discord.allowFrom"); + } + }); + + it('rejects discord legacy dm.policy="open" with empty dm.allowFrom', () => { + const res = validateConfigObject({ + channels: { discord: { dm: { policy: "open", allowFrom: [] } } }, + }); + expect(res.ok).toBe(false); + if (!res.ok) { + expect(res.issues[0]?.path).toBe("channels.discord.dm.allowFrom"); + } + }); + it('accepts discord legacy dm.policy="open" with top-level allowFrom alias', () => { const res = validateConfigObject({ channels: { discord: { dm: { policy: "open", allowFrom: ["123"] }, allowFrom: ["*"] } },