From f92900fc2011506018f0a45acf1ef92e46bc55a0 Mon Sep 17 00:00:00 2001 From: Shadow Date: Sun, 15 Feb 2026 12:41:35 -0600 Subject: [PATCH] Revert "Discord: add preflight role allowlist regression test" This reverts commit 41f546faa58c7f8ff660bbb03684c5d0236c8d52. --- .../monitor/message-handler.preflight.test.ts | 76 ------------------- 1 file changed, 76 deletions(-) delete mode 100644 src/discord/monitor/message-handler.preflight.test.ts diff --git a/src/discord/monitor/message-handler.preflight.test.ts b/src/discord/monitor/message-handler.preflight.test.ts deleted file mode 100644 index b85dfb4f91..0000000000 --- a/src/discord/monitor/message-handler.preflight.test.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { ChannelType } from "@buape/carbon"; -import { beforeEach, describe, expect, it, vi } from "vitest"; -import type { DiscordMessagePreflightParams } from "./message-handler.preflight.types.js"; -import { __resetDiscordChannelInfoCacheForTest } from "./message-utils.js"; - -vi.mock("../../config/config.js", async (importOriginal) => { - const actual = await importOriginal(); - return { - ...actual, - loadConfig: () => ({}), - }; -}); - -const { preflightDiscordMessage } = await import("./message-handler.preflight.js"); - -describe("preflightDiscordMessage role allowlist", () => { - beforeEach(() => { - __resetDiscordChannelInfoCacheForTest(); - }); - - it("allows role allowlist matches from raw member roles", async () => { - const roleMention = { toString: () => "<@&123>" }; - const ctx = await preflightDiscordMessage({ - cfg: {}, - discordConfig: {}, - accountId: "default", - token: "token", - runtime: { log: () => {}, error: () => {} }, - guildHistories: new Map(), - historyLimit: 0, - mediaMaxBytes: 1024, - textLimit: 4000, - replyToMode: "off", - ackReactionScope: "direct", - groupPolicy: "open", - dmEnabled: true, - groupDmEnabled: true, - guildEntries: { - g1: { - roles: ["123"], - requireMention: false, - }, - }, - data: { - guild_id: "g1", - guild: { id: "g1", name: "Guild" }, - member: { roles: [roleMention], nickname: "Alice" }, - rawMember: { roles: ["123"] }, - author: { - id: "u1", - username: "alice", - discriminator: "0", - globalName: "Alice", - bot: false, - }, - message: { - id: "m1", - channelId: "c1", - content: "hello", - attachments: [], - embeds: [], - timestamp: new Date().toISOString(), - mentionedUsers: [], - mentionedRoles: [], - mentionedEveryone: false, - }, - }, - client: { - fetchChannel: async () => ({ type: ChannelType.GuildText, name: "general" }), - rest: {}, - }, - } as unknown as DiscordMessagePreflightParams); - - expect(ctx).not.toBeNull(); - }); -});