mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-18 14:14:45 +00:00
test: guard zalo lifecycle mock calls
This commit is contained in:
@@ -60,6 +60,15 @@ describe("Zalo reply-once lifecycle", () => {
|
||||
});
|
||||
}
|
||||
|
||||
function requireRecordInboundSessionArgs() {
|
||||
const [call] = recordInboundSessionMock.mock.calls;
|
||||
if (!call) {
|
||||
throw new Error("expected inbound session record call");
|
||||
}
|
||||
const [recordArgs] = call;
|
||||
return recordArgs;
|
||||
}
|
||||
|
||||
it("routes one accepted webhook event to one visible reply across duplicate replay", async () => {
|
||||
dispatchReplyWithBufferedBlockDispatcherMock.mockImplementation(
|
||||
async ({ dispatcherOptions }) => {
|
||||
@@ -95,7 +104,7 @@ describe("Zalo reply-once lifecycle", () => {
|
||||
);
|
||||
|
||||
expect(recordInboundSessionMock).toHaveBeenCalledTimes(1);
|
||||
const [recordArgs] = recordInboundSessionMock.mock.calls[0] ?? [];
|
||||
const recordArgs = requireRecordInboundSessionArgs();
|
||||
expect(recordArgs?.sessionKey).toBe("agent:main:zalo:direct:dm-chat-1");
|
||||
expect(recordArgs?.ctx?.AccountId).toBe("acct-zalo-lifecycle");
|
||||
expect(recordArgs?.ctx?.SessionKey).toBe("agent:main:zalo:direct:dm-chat-1");
|
||||
|
||||
Reference in New Issue
Block a user