mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-03 03:03:24 -04:00
fix tests
This commit is contained in:
@@ -87,12 +87,12 @@ describe("discord processDiscordMessage inbound contract", () => {
|
||||
guildInfo: null,
|
||||
guildSlug: "",
|
||||
channelConfig: null,
|
||||
baseSessionKey: "agent:main:discord:dm:u1",
|
||||
baseSessionKey: "agent:main:discord:direct:u1",
|
||||
route: {
|
||||
agentId: "main",
|
||||
channel: "discord",
|
||||
accountId: "default",
|
||||
sessionKey: "agent:main:discord:dm:u1",
|
||||
sessionKey: "agent:main:discord:direct:u1",
|
||||
mainSessionKey: "agent:main:main",
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
} as any,
|
||||
|
||||
@@ -43,7 +43,7 @@ describe("resolveOutboundSessionRoute", () => {
|
||||
target: "@alice",
|
||||
});
|
||||
|
||||
expect(route?.sessionKey).toBe("agent:main:telegram:dm:@alice");
|
||||
expect(route?.sessionKey).toBe("agent:main:telegram:direct:@alice");
|
||||
expect(route?.chatType).toBe("direct");
|
||||
});
|
||||
|
||||
@@ -64,7 +64,7 @@ describe("resolveOutboundSessionRoute", () => {
|
||||
target: "user:123",
|
||||
});
|
||||
|
||||
expect(route?.sessionKey).toBe("agent:main:dm:alice");
|
||||
expect(route?.sessionKey).toBe("agent:main:direct:alice");
|
||||
});
|
||||
|
||||
it("strips chat_* prefixes for BlueBubbles group session keys", async () => {
|
||||
@@ -88,7 +88,7 @@ describe("resolveOutboundSessionRoute", () => {
|
||||
target: "123456",
|
||||
});
|
||||
|
||||
expect(route?.sessionKey).toBe("agent:main:zalouser:dm:123456");
|
||||
expect(route?.sessionKey).toBe("agent:main:zalouser:direct:123456");
|
||||
expect(route?.chatType).toBe("direct");
|
||||
});
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ describe("resolveAgentRoute", () => {
|
||||
accountId: null,
|
||||
peer: { kind: "direct", id: "+15551234567" },
|
||||
});
|
||||
expect(route.sessionKey).toBe("agent:main:dm:+15551234567");
|
||||
expect(route.sessionKey).toBe("agent:main:direct:+15551234567");
|
||||
});
|
||||
|
||||
test("dmScope=per-channel-peer isolates DM sessions per channel and sender", () => {
|
||||
@@ -40,7 +40,7 @@ describe("resolveAgentRoute", () => {
|
||||
accountId: null,
|
||||
peer: { kind: "direct", id: "+15551234567" },
|
||||
});
|
||||
expect(route.sessionKey).toBe("agent:main:whatsapp:dm:+15551234567");
|
||||
expect(route.sessionKey).toBe("agent:main:whatsapp:direct:+15551234567");
|
||||
});
|
||||
|
||||
test("identityLinks collapses per-peer DM sessions across providers", () => {
|
||||
@@ -58,7 +58,7 @@ describe("resolveAgentRoute", () => {
|
||||
accountId: null,
|
||||
peer: { kind: "direct", id: "111111111" },
|
||||
});
|
||||
expect(route.sessionKey).toBe("agent:main:dm:alice");
|
||||
expect(route.sessionKey).toBe("agent:main:direct:alice");
|
||||
});
|
||||
|
||||
test("identityLinks applies to per-channel-peer DM sessions", () => {
|
||||
@@ -76,7 +76,7 @@ describe("resolveAgentRoute", () => {
|
||||
accountId: null,
|
||||
peer: { kind: "direct", id: "222222222222222222" },
|
||||
});
|
||||
expect(route.sessionKey).toBe("agent:main:discord:dm:alice");
|
||||
expect(route.sessionKey).toBe("agent:main:discord:direct:alice");
|
||||
});
|
||||
|
||||
test("peer binding wins over account binding", () => {
|
||||
@@ -237,7 +237,7 @@ test("dmScope=per-account-channel-peer isolates DM sessions per account, channel
|
||||
accountId: "tasks",
|
||||
peer: { kind: "direct", id: "7550356539" },
|
||||
});
|
||||
expect(route.sessionKey).toBe("agent:main:telegram:tasks:dm:7550356539");
|
||||
expect(route.sessionKey).toBe("agent:main:telegram:tasks:direct:7550356539");
|
||||
});
|
||||
|
||||
test("dmScope=per-account-channel-peer uses default accountId when not provided", () => {
|
||||
@@ -250,7 +250,7 @@ test("dmScope=per-account-channel-peer uses default accountId when not provided"
|
||||
accountId: null,
|
||||
peer: { kind: "direct", id: "7550356539" },
|
||||
});
|
||||
expect(route.sessionKey).toBe("agent:main:telegram:default:dm:7550356539");
|
||||
expect(route.sessionKey).toBe("agent:main:telegram:default:direct:7550356539");
|
||||
});
|
||||
|
||||
describe("parentPeer binding inheritance (thread support)", () => {
|
||||
|
||||
Reference in New Issue
Block a user