fix(discord): honor thread allowlists in reactions
Co-authored-by: Codex <codex@openai.com>
This commit is contained in:
24
src/channels/channel-config.test.ts
Normal file
24
src/channels/channel-config.test.ts
Normal 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("*");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user