fix(discord): honor thread allowlists in reactions

Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
Peter Steinberger
2026-01-17 22:39:09 +00:00
parent e63e483c38
commit 5aed38eebc
4 changed files with 101 additions and 19 deletions

View File

@@ -0,0 +1,24 @@
import { describe, expect, it } from "vitest";
import { buildChannelKeyCandidates, resolveChannelEntryMatch } from "./channel-config.js";
describe("buildChannelKeyCandidates", () => {
it("dedupes and trims keys", () => {
expect(buildChannelKeyCandidates(" a ", "a", "", "b", "b")).toEqual(["a", "b"]);
});
});
describe("resolveChannelEntryMatch", () => {
it("returns matched entry and wildcard metadata", () => {
const entries = { a: { allow: true }, "*": { allow: false } };
const match = resolveChannelEntryMatch({
entries,
keys: ["missing", "a"],
wildcardKey: "*",
});
expect(match.entry).toBe(entries.a);
expect(match.key).toBe("a");
expect(match.wildcardEntry).toBe(entries["*"]);
expect(match.wildcardKey).toBe("*");
});
});