mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-02 04:41:11 +00:00
test(slack): cover binding-aware system event routing
This commit is contained in:
@@ -184,6 +184,53 @@ describe("resolveSlackSystemEventSessionKey", () => {
|
||||
"agent:main:slack:channel:c123",
|
||||
);
|
||||
});
|
||||
|
||||
it("routes channel system events through account bindings", () => {
|
||||
const ctx = createSlackMonitorContext({
|
||||
...baseParams(),
|
||||
accountId: "work",
|
||||
cfg: {
|
||||
bindings: [
|
||||
{
|
||||
agentId: "ops",
|
||||
match: {
|
||||
channel: "slack",
|
||||
accountId: "work",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
expect(
|
||||
ctx.resolveSlackSystemEventSessionKey({ channelId: "C123", channelType: "channel" }),
|
||||
).toBe("agent:ops:slack:channel:c123");
|
||||
});
|
||||
|
||||
it("routes DM system events through direct-peer bindings when sender is known", () => {
|
||||
const ctx = createSlackMonitorContext({
|
||||
...baseParams(),
|
||||
accountId: "work",
|
||||
cfg: {
|
||||
bindings: [
|
||||
{
|
||||
agentId: "ops-dm",
|
||||
match: {
|
||||
channel: "slack",
|
||||
accountId: "work",
|
||||
peer: { kind: "direct", id: "U123" },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
});
|
||||
expect(
|
||||
ctx.resolveSlackSystemEventSessionKey({
|
||||
channelId: "D123",
|
||||
channelType: "im",
|
||||
senderId: "U123",
|
||||
}),
|
||||
).toBe("agent:ops-dm:main");
|
||||
});
|
||||
});
|
||||
|
||||
describe("isChannelAllowed with groupPolicy and channelsConfig", () => {
|
||||
|
||||
Reference in New Issue
Block a user