mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 15:45:01 +00:00
test(signal): dedupe receive event fixtures and add mention clamp case
This commit is contained in:
@@ -13,7 +13,10 @@ vi.mock("../../auto-reply/dispatch.js", async (importOriginal) => {
|
||||
});
|
||||
|
||||
import { createSignalEventHandler } from "./event-handler.js";
|
||||
import { createBaseSignalEventHandlerDeps } from "./event-handler.test-harness.js";
|
||||
import {
|
||||
createBaseSignalEventHandlerDeps,
|
||||
createSignalReceiveEvent,
|
||||
} from "./event-handler.test-harness.js";
|
||||
|
||||
describe("signal createSignalEventHandler inbound contract", () => {
|
||||
it("passes a finalized MsgContext to dispatchInboundMessage", async () => {
|
||||
@@ -27,21 +30,15 @@ describe("signal createSignalEventHandler inbound contract", () => {
|
||||
}),
|
||||
);
|
||||
|
||||
await handler({
|
||||
event: "receive",
|
||||
data: JSON.stringify({
|
||||
envelope: {
|
||||
sourceNumber: "+15550001111",
|
||||
sourceName: "Alice",
|
||||
timestamp: 1700000000000,
|
||||
dataMessage: {
|
||||
message: "hi",
|
||||
attachments: [],
|
||||
groupInfo: { groupId: "g1", groupName: "Test Group" },
|
||||
},
|
||||
await handler(
|
||||
createSignalReceiveEvent({
|
||||
dataMessage: {
|
||||
message: "hi",
|
||||
attachments: [],
|
||||
groupInfo: { groupId: "g1", groupName: "Test Group" },
|
||||
},
|
||||
}),
|
||||
});
|
||||
);
|
||||
|
||||
expect(capturedCtx).toBeTruthy();
|
||||
expectInboundContextContract(capturedCtx!);
|
||||
@@ -63,20 +60,17 @@ describe("signal createSignalEventHandler inbound contract", () => {
|
||||
}),
|
||||
);
|
||||
|
||||
await handler({
|
||||
event: "receive",
|
||||
data: JSON.stringify({
|
||||
envelope: {
|
||||
sourceNumber: "+15550002222",
|
||||
sourceName: "Bob",
|
||||
timestamp: 1700000000001,
|
||||
dataMessage: {
|
||||
message: "hello",
|
||||
attachments: [],
|
||||
},
|
||||
await handler(
|
||||
createSignalReceiveEvent({
|
||||
sourceNumber: "+15550002222",
|
||||
sourceName: "Bob",
|
||||
timestamp: 1700000000001,
|
||||
dataMessage: {
|
||||
message: "hello",
|
||||
attachments: [],
|
||||
},
|
||||
}),
|
||||
});
|
||||
);
|
||||
|
||||
expect(capturedCtx).toBeTruthy();
|
||||
const context = capturedCtx as unknown as {
|
||||
|
||||
Reference in New Issue
Block a user