test: guard zalo lifecycle mock calls · openclaw/openclaw@6ac981f
steipete
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -60,6 +60,15 @@ describe("Zalo reply-once lifecycle", () => {
|
60 | 60 | }); |
61 | 61 | } |
62 | 62 | |
| 63 | +function requireRecordInboundSessionArgs() { |
| 64 | +const [call] = recordInboundSessionMock.mock.calls; |
| 65 | +if (!call) { |
| 66 | +throw new Error("expected inbound session record call"); |
| 67 | +} |
| 68 | +const [recordArgs] = call; |
| 69 | +return recordArgs; |
| 70 | +} |
| 71 | + |
63 | 72 | it("routes one accepted webhook event to one visible reply across duplicate replay", async () => { |
64 | 73 | dispatchReplyWithBufferedBlockDispatcherMock.mockImplementation( |
65 | 74 | async ({ dispatcherOptions }) => { |
@@ -95,7 +104,7 @@ describe("Zalo reply-once lifecycle", () => {
|
95 | 104 | ); |
96 | 105 | |
97 | 106 | expect(recordInboundSessionMock).toHaveBeenCalledTimes(1); |
98 | | -const [recordArgs] = recordInboundSessionMock.mock.calls[0] ?? []; |
| 107 | +const recordArgs = requireRecordInboundSessionArgs(); |
99 | 108 | expect(recordArgs?.sessionKey).toBe("agent:main:zalo:direct:dm-chat-1"); |
100 | 109 | expect(recordArgs?.ctx?.AccountId).toBe("acct-zalo-lifecycle"); |
101 | 110 | expect(recordArgs?.ctx?.SessionKey).toBe("agent:main:zalo:direct:dm-chat-1"); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。