mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 23:14:32 +00:00
fix: unify inbound sender labels
This commit is contained in:
34
src/web/auto-reply/monitor/message-line.test.ts
Normal file
34
src/web/auto-reply/monitor/message-line.test.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { buildInboundLine } from "./message-line.js";
|
||||
|
||||
describe("buildInboundLine", () => {
|
||||
it("prefixes group messages with sender", () => {
|
||||
const line = buildInboundLine({
|
||||
cfg: {
|
||||
agents: { defaults: { workspace: "/tmp/clawd" } },
|
||||
channels: { whatsapp: { messagePrefix: "" } },
|
||||
} as never,
|
||||
agentId: "main",
|
||||
msg: {
|
||||
from: "123@g.us",
|
||||
conversationId: "123@g.us",
|
||||
to: "+15550009999",
|
||||
accountId: "default",
|
||||
body: "ping",
|
||||
timestamp: 1700000000000,
|
||||
chatType: "group",
|
||||
chatId: "123@g.us",
|
||||
senderJid: "111@s.whatsapp.net",
|
||||
senderE164: "+15550001111",
|
||||
senderName: "Bob",
|
||||
sendComposing: async () => undefined,
|
||||
reply: async () => undefined,
|
||||
sendMedia: async () => undefined,
|
||||
} as never,
|
||||
});
|
||||
|
||||
expect(line).toContain("Bob (+15550001111):");
|
||||
expect(line).toContain("ping");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user