mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-02 10:30:22 +00:00
test: trim duplicate cross-context policy cases
This commit is contained in:
@@ -621,18 +621,6 @@ const discordConfig = {
|
||||
} as OpenClawConfig;
|
||||
|
||||
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", () => {
|
||||
const cfg = {
|
||||
...slackConfig,
|
||||
@@ -652,23 +640,6 @@ describe("outbound policy", () => {
|
||||
).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 () => {
|
||||
const decoration = await buildCrossContextDecoration({
|
||||
cfg: discordConfig,
|
||||
|
||||
Reference in New Issue
Block a user