mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 21:54:32 +00:00
test: trim duplicate cross-context policy cases
This commit is contained in:
@@ -621,18 +621,6 @@ const discordConfig = {
|
|||||||
} as OpenClawConfig;
|
} as OpenClawConfig;
|
||||||
|
|
||||||
describe("outbound policy", () => {
|
describe("outbound policy", () => {
|
||||||
it("blocks cross-provider sends by default", () => {
|
|
||||||
expect(() =>
|
|
||||||
enforceCrossContextPolicy({
|
|
||||||
cfg: slackConfig,
|
|
||||||
channel: "telegram",
|
|
||||||
action: "send",
|
|
||||||
args: { to: "telegram:@ops" },
|
|
||||||
toolContext: { currentChannelId: "C12345678", currentChannelProvider: "slack" },
|
|
||||||
}),
|
|
||||||
).toThrow(/Cross-context messaging denied/);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("allows cross-provider sends when enabled", () => {
|
it("allows cross-provider sends when enabled", () => {
|
||||||
const cfg = {
|
const cfg = {
|
||||||
...slackConfig,
|
...slackConfig,
|
||||||
@@ -652,23 +640,6 @@ describe("outbound policy", () => {
|
|||||||
).not.toThrow();
|
).not.toThrow();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("blocks same-provider cross-context when disabled", () => {
|
|
||||||
const cfg = {
|
|
||||||
...slackConfig,
|
|
||||||
tools: { message: { crossContext: { allowWithinProvider: false } } },
|
|
||||||
} as OpenClawConfig;
|
|
||||||
|
|
||||||
expect(() =>
|
|
||||||
enforceCrossContextPolicy({
|
|
||||||
cfg,
|
|
||||||
channel: "slack",
|
|
||||||
action: "send",
|
|
||||||
args: { to: "C99999999" },
|
|
||||||
toolContext: { currentChannelId: "C12345678", currentChannelProvider: "slack" },
|
|
||||||
}),
|
|
||||||
).toThrow(/Cross-context messaging denied/);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("uses components when available and preferred", async () => {
|
it("uses components when available and preferred", async () => {
|
||||||
const decoration = await buildCrossContextDecoration({
|
const decoration = await buildCrossContextDecoration({
|
||||||
cfg: discordConfig,
|
cfg: discordConfig,
|
||||||
|
|||||||
Reference in New Issue
Block a user