mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-26 00:01:14 +00:00
* refactor(channels): migrate irc, nextcloud-talk, zalouser, slack, and matrix group policy onto the scope tree * fix(irc): drop unused tree binding in group match * fix(zalouser): keep wildcard lookup opt-in for explicit-only candidates * fix(zalouser): adapter opts into the wildcard fallback candidate * refactor(channels): migrate feishu, msteams, and discord group policy onto the scope tree and drop the core discord duplicate * fix(msteams): restore the cross-team scan fallback for policy-less matched teams * fix(feishu): keep the adapter's zod-typed group config for the scope tree * revert(core): keep the discord require-mention fallback until stage 3 makes it provably redundant * chore(matrix): drop the now-unused channel entry match re-export * refactor(telegram): migrate group policy onto the scope tree * test(telegram): keep the bot token fixture off secret-scanner patterns * test(telegram): use a computed key for the bot token fixture * test(telegram): assemble the bot token fixture indirectly for scanner and lint
49 lines
1.5 KiB
TypeScript
49 lines
1.5 KiB
TypeScript
// Nextcloud Talk tests cover group policy plugin behavior.
|
|
import type { OpenClawConfig } from "openclaw/plugin-sdk/config-contracts";
|
|
import { describe, expect, it } from "vitest";
|
|
import {
|
|
resolveNextcloudTalkGroupRequireMention,
|
|
resolveNextcloudTalkGroupToolPolicy,
|
|
} from "./policy.js";
|
|
|
|
describe("nextcloud-talk group policy", () => {
|
|
it("keeps exact mention matching separate from slug-matched tools", () => {
|
|
const cfg = {
|
|
channels: {
|
|
"nextcloud-talk": {
|
|
rooms: {
|
|
"team-room": {
|
|
requireMention: false,
|
|
tools: { allow: ["sessions.list"] },
|
|
},
|
|
"*": { requireMention: true, tools: { deny: ["exec"] } },
|
|
},
|
|
},
|
|
},
|
|
} as OpenClawConfig;
|
|
const params = { cfg, groupId: "Team Room" };
|
|
|
|
expect(resolveNextcloudTalkGroupRequireMention(params)).toBe(true);
|
|
expect(resolveNextcloudTalkGroupToolPolicy(params)).toEqual({
|
|
allow: ["sessions.list"],
|
|
});
|
|
});
|
|
|
|
it("falls through to wildcard fields when the exact room field is unset", () => {
|
|
const cfg = {
|
|
channels: {
|
|
"nextcloud-talk": {
|
|
rooms: {
|
|
"team-room": {},
|
|
"*": { requireMention: false, tools: { deny: ["exec"] } },
|
|
},
|
|
},
|
|
},
|
|
} as OpenClawConfig;
|
|
const params = { cfg, groupId: "team-room" };
|
|
|
|
expect(resolveNextcloudTalkGroupRequireMention(params)).toBe(false);
|
|
expect(resolveNextcloudTalkGroupToolPolicy(params)).toEqual({ deny: ["exec"] });
|
|
});
|
|
});
|