test: trim duplicate cross-context policy cases

This commit is contained in:
Peter Steinberger
2026-02-19 07:50:19 +00:00
parent bbb07bdc19
commit 18d4ad6aab

View File

@@ -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,