





















@@ -1148,9 +1148,9 @@ describe("preflightDiscordMessage", () => {
11481148},
11491149});
115011501151-expect(result).not.toBeNull();
1152-expect(result?.shouldRequireMention).toBe(true);
1153-expect(result?.wasMentioned).toBe(true);
1151+const preflight = expectPreflightResult(result);
1152+expect(preflight.shouldRequireMention).toBe(true);
1153+expect(preflight.wasMentioned).toBe(true);
11541154});
1155115511561156it("accepts allowlisted guild messages when guild object is missing", async () => {
@@ -1183,10 +1183,10 @@ describe("preflightDiscordMessage", () => {
11831183includeGuildObject: false,
11841184});
118511851186-expect(result).not.toBeNull();
1187-expect(result?.guildInfo?.id).toBe("guild-1");
1188-expect(result?.channelConfig?.allowed).toBe(true);
1189-expect(result?.shouldRequireMention).toBe(false);
1186+const preflight = expectPreflightResult(result);
1187+expect(preflight.guildInfo?.id).toBe("guild-1");
1188+expect(preflight.channelConfig?.allowed).toBe(true);
1189+expect(preflight.shouldRequireMention).toBe(false);
11901190});
1191119111921192it("inherits parent thread allowlist when guild object is missing", async () => {
@@ -1231,11 +1231,11 @@ describe("preflightDiscordMessage", () => {
12311231},
12321232});
123312331234-expect(result).not.toBeNull();
1235-expect(result?.guildInfo?.id).toBe("guild-1");
1236-expect(result?.threadParentId).toBe(parentId);
1237-expect(result?.channelConfig?.allowed).toBe(true);
1238-expect(result?.shouldRequireMention).toBe(false);
1234+const preflight = expectPreflightResult(result);
1235+expect(preflight.guildInfo?.id).toBe("guild-1");
1236+expect(preflight.threadParentId).toBe(parentId);
1237+expect(preflight.channelConfig?.allowed).toBe(true);
1238+expect(preflight.shouldRequireMention).toBe(false);
12391239});
1240124012411241it("handles partial thread channel owner getters during mention preflight", async () => {
@@ -1294,9 +1294,9 @@ describe("preflightDiscordMessage", () => {
12941294},
12951295});
129612961297-expect(result).not.toBeNull();
1298-expect(result?.threadParentId).toBe(parentId);
1299-expect(result?.shouldRequireMention).toBe(false);
1297+const preflight = expectPreflightResult(result);
1298+expect(preflight.threadParentId).toBe(parentId);
1299+expect(preflight.shouldRequireMention).toBe(false);
13001300});
1301130113021302it("drops guild messages that mention another user when ignoreOtherMentions=true", async () => {
@@ -1336,8 +1336,7 @@ describe("preflightDiscordMessage", () => {
1336133613371337const result = await runIgnoreOtherMentionsPreflight({ channelId, guildId, message });
133813381339-expect(result).not.toBeNull();
1340-expect(result?.hasAnyMention).toBe(true);
1339+expect(expectPreflightResult(result).hasAnyMention).toBe(true);
13411340});
1342134113431342it("ignores bot-sent @everyone mentions for detection", async () => {
@@ -1377,8 +1376,7 @@ describe("preflightDiscordMessage", () => {
13771376},
13781377});
137913781380-expect(result).not.toBeNull();
1381-expect(result?.hasAnyMention).toBe(false);
1379+expect(expectPreflightResult(result).hasAnyMention).toBe(false);
13821380});
1383138113841382it("does not treat bot-sent @everyone as wasMentioned", async () => {
@@ -1418,8 +1416,7 @@ describe("preflightDiscordMessage", () => {
14181416},
14191417});
142014181421-expect(result).not.toBeNull();
1422-expect(result?.wasMentioned).toBe(false);
1419+expect(expectPreflightResult(result).wasMentioned).toBe(false);
14231420});
1424142114251422it("uses attachment content_type for guild audio preflight mention detection", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。