




















@@ -333,7 +333,9 @@ describe("thread binding lifecycle", () => {
333333expect(hoisted.restGet).not.toHaveBeenCalled();
334334expect(hoisted.sendWebhookMessageDiscord).not.toHaveBeenCalled();
335335expect(hoisted.sendMessageDiscord).toHaveBeenCalledTimes(1);
336-const farewell = hoisted.sendMessageDiscord.mock.calls[0]?.[1] as string | undefined;
336+const farewell = mockCallArg(hoisted.sendMessageDiscord, 0, 1, "sendMessageDiscord") as
337+| string
338+| undefined;
337339expect(farewell).toContain("after 1m of inactivity");
338340} finally {
339341vi.useRealTimers();
@@ -372,7 +374,9 @@ describe("thread binding lifecycle", () => {
372374373375expect(manager.getByThreadId("thread-1")).toBeUndefined();
374376expect(hoisted.sendMessageDiscord).toHaveBeenCalledTimes(1);
375-const farewell = hoisted.sendMessageDiscord.mock.calls[0]?.[1] as string | undefined;
377+const farewell = mockCallArg(hoisted.sendMessageDiscord, 0, 1, "sendMessageDiscord") as
378+| string
379+| undefined;
376380expect(farewell).toContain("max age of 1m");
377381} finally {
378382vi.useRealTimers();
@@ -949,9 +953,12 @@ describe("thread binding lifecycle", () => {
949953threadId: "thread-created-runtime",
950954targetSessionKey: "agent:main:subagent:child-runtime",
951955});
952-const firstClientArgs = hoisted.createDiscordRestClient.mock.calls[0]?.[0] as
953-| { accountId?: string; token?: string }
954-| undefined;
956+const firstClientArgs = mockCallArg(
957+hoisted.createDiscordRestClient,
958+0,
959+0,
960+"createDiscordRestClient",
961+) as { accountId?: string; token?: string } | undefined;
955962expectFields(firstClientArgs, "first client args", {
956963accountId: "runtime",
957964token: "runtime-token",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。