mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 16:53:49 +00:00
refactor(channels): dedupe plugin routing and channel helpers
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user