mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-26 19:25:34 +00:00
test: tighten discord status issue assertions
This commit is contained in:
@@ -20,20 +20,23 @@ describe("collectDiscordStatusIssues", () => {
|
||||
} as ChannelAccountSnapshot,
|
||||
]);
|
||||
|
||||
expect(issues).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
channel: "discord",
|
||||
accountId: "ops",
|
||||
kind: "intent",
|
||||
}),
|
||||
expect.objectContaining({
|
||||
channel: "discord",
|
||||
accountId: "ops",
|
||||
kind: "config",
|
||||
}),
|
||||
]),
|
||||
);
|
||||
expect(issues).toEqual([
|
||||
{
|
||||
channel: "discord",
|
||||
accountId: "ops",
|
||||
kind: "intent",
|
||||
message: "Message Content Intent is disabled. Bot may not see normal channel messages.",
|
||||
fix: "Enable Message Content Intent in Discord Dev Portal → Bot → Privileged Gateway Intents, or require mention-only operation.",
|
||||
},
|
||||
{
|
||||
channel: "discord",
|
||||
accountId: "ops",
|
||||
kind: "config",
|
||||
message:
|
||||
"Some configured guild channels are not numeric IDs (unresolvedChannels=2). Permission audit can only check numeric channel IDs.",
|
||||
fix: "Use numeric channel IDs as keys in channels.discord.guilds.*.channels (then rerun channels status --probe).",
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("reports channel permission failures with match metadata", () => {
|
||||
@@ -57,15 +60,16 @@ describe("collectDiscordStatusIssues", () => {
|
||||
} as ChannelAccountSnapshot,
|
||||
]);
|
||||
|
||||
expect(issues).toHaveLength(1);
|
||||
expect(issues[0]).toMatchObject({
|
||||
channel: "discord",
|
||||
accountId: "ops",
|
||||
kind: "permissions",
|
||||
});
|
||||
expect(issues[0]?.message).toContain("Channel 123 permission check failed");
|
||||
expect(issues[0]?.message).toContain("alerts");
|
||||
expect(issues[0]?.message).toContain("guilds.ops.channels");
|
||||
expect(issues).toEqual([
|
||||
{
|
||||
channel: "discord",
|
||||
accountId: "ops",
|
||||
kind: "permissions",
|
||||
message:
|
||||
"Channel 123 permission check failed. missing ViewChannel, SendMessages: 403 (matchKey=alerts matchSource=guilds.ops.channels)",
|
||||
fix: "Ensure the bot role can view + send in this channel (and that channel overrides don't deny it).",
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
it("reports degraded runtime transport state", () => {
|
||||
@@ -81,12 +85,13 @@ describe("collectDiscordStatusIssues", () => {
|
||||
]);
|
||||
|
||||
expect(issues).toEqual([
|
||||
expect.objectContaining({
|
||||
{
|
||||
channel: "discord",
|
||||
accountId: "ops",
|
||||
kind: "runtime",
|
||||
message: expect.stringContaining("stale-socket"),
|
||||
}),
|
||||
message: "Discord gateway transport is degraded (stale-socket; account is running).",
|
||||
fix: "Check gateway event-loop health and Discord connectivity, then restart the Discord channel or gateway if the transport does not recover.",
|
||||
},
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user