mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 11:04:59 +00:00
fix(signal): canonicalize message targets in tool and inbound flows
This commit is contained in:
@@ -51,4 +51,41 @@ describe("signal createSignalEventHandler inbound contract", () => {
|
||||
expect(String(contextWithBody.Body ?? "")).toMatch(/Alice.*:/);
|
||||
expect(String(contextWithBody.Body ?? "")).not.toContain("[from:");
|
||||
});
|
||||
|
||||
it("normalizes direct chat To/OriginatingTo targets to canonical Signal ids", async () => {
|
||||
capturedCtx = undefined;
|
||||
|
||||
const handler = createSignalEventHandler(
|
||||
createBaseSignalEventHandlerDeps({
|
||||
// oxlint-disable-next-line typescript/no-explicit-any
|
||||
cfg: { messages: { inbound: { debounceMs: 0 } } } as any,
|
||||
historyLimit: 0,
|
||||
}),
|
||||
);
|
||||
|
||||
await handler({
|
||||
event: "receive",
|
||||
data: JSON.stringify({
|
||||
envelope: {
|
||||
sourceNumber: "+15550002222",
|
||||
sourceName: "Bob",
|
||||
timestamp: 1700000000001,
|
||||
dataMessage: {
|
||||
message: "hello",
|
||||
attachments: [],
|
||||
},
|
||||
},
|
||||
}),
|
||||
});
|
||||
|
||||
expect(capturedCtx).toBeTruthy();
|
||||
const context = capturedCtx as unknown as {
|
||||
ChatType?: string;
|
||||
To?: string;
|
||||
OriginatingTo?: string;
|
||||
};
|
||||
expect(context.ChatType).toBe("direct");
|
||||
expect(context.To).toBe("+15550002222");
|
||||
expect(context.OriginatingTo).toBe("+15550002222");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user