test(slack): cover binding-aware system event routing

This commit is contained in:
Vincent Koc
2026-03-04 01:11:35 -05:00
parent 2dd6794d0e
commit b41aafb9c0

View File

@@ -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", () => {