test (discord): cover empty guild channels config fallback

This commit is contained in:
Vignesh Natarajan
2026-02-14 19:04:13 -08:00
parent 7b4984e73d
commit 66414b28ba

View File

@@ -253,6 +253,19 @@ describe("discord guild/channel resolution", () => {
expect(channel?.allowed).toBe(false);
});
it("treats empty channel config map as no channel allowlist", () => {
const guildInfo: DiscordGuildEntryResolved = {
channels: {},
};
const channel = resolveDiscordChannelConfig({
guildInfo,
channelId: "999",
channelName: "random",
channelSlug: "random",
});
expect(channel).toBeNull();
});
it("inherits parent config for thread channels", () => {
const guildInfo: DiscordGuildEntryResolved = {
channels: {
@@ -345,6 +358,23 @@ describe("discord guild/channel resolution", () => {
expect(thread?.matchKey).toBe("*");
expect(thread?.matchSource).toBe("wildcard");
});
it("treats empty channel config map as no thread allowlist", () => {
const guildInfo: DiscordGuildEntryResolved = {
channels: {},
};
const thread = resolveDiscordChannelConfigWithFallback({
guildInfo,
channelId: "thread-123",
channelName: "topic",
channelSlug: "topic",
parentId: "parent-999",
parentName: "general",
parentSlug: "general",
scope: "thread",
});
expect(thread).toBeNull();
});
});
describe("discord mention gating", () => {