






















@@ -368,7 +368,9 @@ async function runMainAgentAndCaptureEntry(idempotencyKey: string) {
368368}
369369370370function readLastAgentCommandCall(): AgentCommandCall | undefined {
371-return mocks.agentCommand.mock.calls.at(-1)?.[0] as AgentCommandCall | undefined;
371+const calls = mocks.agentCommand.mock.calls;
372+const call = calls[calls.length - 1];
373+return call?.[0] as AgentCommandCall | undefined;
372374}
373375374376function backendGatewayClient(): AgentHandlerArgs["client"] {
@@ -605,12 +607,11 @@ describe("gateway agent handler", () => {
605607expect(capturedEntry?.groupId).toBe("C123");
606608expect(capturedEntry?.groupChannel).toBe("#trusted");
607609expect(capturedEntry?.space).toBe("TTRUSTED");
608-await waitForAssertion(() => expect(mocks.agentCommand).toHaveBeenCalled());
609-const callArgs = mocks.agentCommand.mock.calls.at(-1)?.[0] as {
610+const callArgs = await waitForAgentCommandCall<{
610611groupChannel?: string;
611612groupSpace?: string;
612613runContext?: { groupChannel?: string; groupSpace?: string };
613-};
614+}>();
614615expect(callArgs.groupChannel).toBe("#trusted");
615616expect(callArgs.groupSpace).toBe("TTRUSTED");
616617expect(callArgs.runContext?.groupChannel).toBe("#trusted");
@@ -657,12 +658,11 @@ describe("gateway agent handler", () => {
657658expect(capturedEntry?.groupId).toBe("C123");
658659expect(capturedEntry?.groupChannel).toBe("#general");
659660expect(capturedEntry?.space).toBe("TWORKSPACE");
660-await waitForAssertion(() => expect(mocks.agentCommand).toHaveBeenCalled());
661-const callArgs = mocks.agentCommand.mock.calls.at(-1)?.[0] as {
661+const callArgs = await waitForAgentCommandCall<{
662662groupChannel?: string;
663663groupSpace?: string;
664664runContext?: { groupChannel?: string; groupSpace?: string };
665-};
665+}>();
666666expect(callArgs.groupChannel).toBe("#general");
667667expect(callArgs.groupSpace).toBe("TWORKSPACE");
668668expect(callArgs.runContext?.groupChannel).toBe("#general");
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。