mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-28 17:01:53 +03: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);
|
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", () => {
|
it("inherits parent config for thread channels", () => {
|
||||||
const guildInfo: DiscordGuildEntryResolved = {
|
const guildInfo: DiscordGuildEntryResolved = {
|
||||||
channels: {
|
channels: {
|
||||||
@@ -345,6 +358,23 @@ describe("discord guild/channel resolution", () => {
|
|||||||
expect(thread?.matchKey).toBe("*");
|
expect(thread?.matchKey).toBe("*");
|
||||||
expect(thread?.matchSource).toBe("wildcard");
|
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", () => {
|
describe("discord mention gating", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user