mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-19 18:39:20 -05:00
test (discord): cover empty guild channels config fallback
This commit is contained in:
@@ -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", () => {
|
||||
|
||||
Reference in New Issue
Block a user