refactor(channels): dedupe plugin routing and channel helpers

This commit is contained in:
Peter Steinberger
2026-02-22 14:05:46 +00:00
parent 7abae052f9
commit 66f814a0af
57 changed files with 3744 additions and 2127 deletions

View File

@@ -37,22 +37,20 @@ describe("resolveMentionGating", () => {
});
describe("resolveMentionGatingWithBypass", () => {
it("enables bypass when control commands are authorized", () => {
const res = resolveMentionGatingWithBypass({
isGroup: true,
requireMention: true,
canDetectMention: true,
wasMentioned: false,
hasAnyMention: false,
allowTextCommands: true,
hasControlCommand: true,
it.each([
{
name: "enables bypass when control commands are authorized",
commandAuthorized: true,
});
expect(res.shouldBypassMention).toBe(true);
expect(res.shouldSkip).toBe(false);
});
it("does not bypass when control commands are not authorized", () => {
shouldBypassMention: true,
shouldSkip: false,
},
{
name: "does not bypass when control commands are not authorized",
commandAuthorized: false,
shouldBypassMention: false,
shouldSkip: true,
},
])("$name", ({ commandAuthorized, shouldBypassMention, shouldSkip }) => {
const res = resolveMentionGatingWithBypass({
isGroup: true,
requireMention: true,
@@ -61,9 +59,9 @@ describe("resolveMentionGatingWithBypass", () => {
hasAnyMention: false,
allowTextCommands: true,
hasControlCommand: true,
commandAuthorized: false,
commandAuthorized,
});
expect(res.shouldBypassMention).toBe(false);
expect(res.shouldSkip).toBe(true);
expect(res.shouldBypassMention).toBe(shouldBypassMention);
expect(res.shouldSkip).toBe(shouldSkip);
});
});