






















@@ -74,6 +74,14 @@ async function flushMcpNotifications() {
7474await Promise.resolve();
7575}
767677+function requireFirstMockCall(mock: { mock: { calls: unknown[][] } }, label: string): unknown[] {
78+const call = mock.mock.calls.at(0);
79+if (!call) {
80+throw new Error(`expected ${label} call`);
81+}
82+return call;
83+}
84+7785function gatewayRequestError(retryable: boolean): Error {
7886return Object.assign(new Error(retryable ? "gateway busy" : "auth failed"), {
7987name: "GatewayClientRequestError",
@@ -383,7 +391,7 @@ describe("openclaw channel mcp server", () => {
383391});
384392385393expect(gatewayRequest).toHaveBeenCalledTimes(1);
386-const [method, payload] = gatewayRequest.mock.calls[0] ?? [];
394+const [method, payload] = requireFirstMockCall(gatewayRequest, "gateway request");
387395expect(method).toBe("send");
388396const sendPayload = payload as Record<string, unknown>;
389397expect(sendPayload.to).toBe("-100123");
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。