




























@@ -177,7 +177,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
177177chatId: "oc_chat",
178178});
179179180-return createReplyDispatcherWithTypingMock.mock.calls[0]?.[0];
180+return createReplyDispatcherWithTypingMock.mock.calls.at(0)?.[0];
181181}
182182183183function createRuntimeLogger() {
@@ -227,7 +227,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
227227callIndex = 0,
228228argIndex = 0,
229229): Record<string, unknown> {
230-return expectRecordFields(mock.mock.calls[callIndex]?.[argIndex], label, expected);
230+return expectRecordFields(mock.mock.calls.at(callIndex)?.[argIndex], label, expected);
231231}
232232233233function expectLastMockArgFields(
@@ -248,9 +248,9 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
248248if (!start) {
249249throw new Error(`Expected streaming instance ${instanceIndex}`);
250250}
251-expect(start.mock.calls[0]?.[0]).toBe("oc_chat");
252-expect(start.mock.calls[0]?.[1]).toBe("chat_id");
253-return expectRecordFields(start.mock.calls[0]?.[2], "streaming start options", expected);
251+expect(start.mock.calls.at(0)?.[0]).toBe("oc_chat");
252+expect(start.mock.calls.at(0)?.[1]).toBe("chat_id");
253+return expectRecordFields(start.mock.calls.at(0)?.[2], "streaming start options", expected);
254254}
255255256256function streamingUpdateTexts(instanceIndex = 0): string[] {
@@ -280,7 +280,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
280280replyToMessageId: "om_parent",
281281});
282282283-const options = createReplyDispatcherWithTypingMock.mock.calls[0]?.[0];
283+const options = createReplyDispatcherWithTypingMock.mock.calls.at(0)?.[0];
284284await options.onReplyStart?.();
285285286286expect(addTypingIndicatorMock).not.toHaveBeenCalled();
@@ -296,7 +296,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
296296messageCreateTimeMs: Date.now() - 3 * 60_000,
297297});
298298299-const options = createReplyDispatcherWithTypingMock.mock.calls[0]?.[0];
299+const options = createReplyDispatcherWithTypingMock.mock.calls.at(0)?.[0];
300300await options.onReplyStart?.();
301301302302expect(addTypingIndicatorMock).not.toHaveBeenCalled();
@@ -312,7 +312,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
312312messageCreateTimeMs: Math.floor((Date.now() - 3 * 60_000) / 1000),
313313});
314314315-const options = createReplyDispatcherWithTypingMock.mock.calls[0]?.[0];
315+const options = createReplyDispatcherWithTypingMock.mock.calls.at(0)?.[0];
316316await options.onReplyStart?.();
317317318318expect(addTypingIndicatorMock).not.toHaveBeenCalled();
@@ -328,7 +328,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
328328messageCreateTimeMs: Date.now() - 30_000,
329329});
330330331-const options = createReplyDispatcherWithTypingMock.mock.calls[0]?.[0];
331+const options = createReplyDispatcherWithTypingMock.mock.calls.at(0)?.[0];
332332await options.onReplyStart?.();
333333334334expect(addTypingIndicatorMock).toHaveBeenCalledTimes(1);
@@ -353,7 +353,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
353353await options.deliver({ text: "plain text" }, { kind: "final" });
354354355355expect(sendMessageFeishuMock).toHaveBeenCalledTimes(1);
356-expect(sendMessageFeishuMock.mock.calls[0]?.[0]).not.toHaveProperty("mentions");
356+expect(sendMessageFeishuMock.mock.calls.at(0)?.[0]).not.toHaveProperty("mentions");
357357});
358358359359it("does not attach automatic mentions to card replies", async () => {
@@ -374,7 +374,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
374374await options.deliver({ text: "card text" }, { kind: "final" });
375375376376expect(sendStructuredCardFeishuMock).toHaveBeenCalledTimes(1);
377-expect(sendStructuredCardFeishuMock.mock.calls[0]?.[0]).not.toHaveProperty("mentions");
377+expect(sendStructuredCardFeishuMock.mock.calls.at(0)?.[0]).not.toHaveProperty("mentions");
378378});
379379380380it("suppresses internal block payload delivery", async () => {
@@ -1017,7 +1017,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
10171017}
1018101810191019expect(streamingInstances[0].close).toHaveBeenCalledTimes(1);
1020-const closeArg = streamingInstances[0].close.mock.calls[0][0] as string;
1020+const closeArg = streamingInstances[0].close.mock.calls.at(0)?.[0] as string;
10211021expect(closeArg).toContain("> 💭 **Thinking**");
10221022expect(closeArg).toContain("---");
10231023expect(closeArg).toContain("answer part final");
@@ -1075,7 +1075,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
1075107510761076expect(streamingInstances).toHaveLength(1);
10771077expect(streamingInstances[0].close).toHaveBeenCalledTimes(1);
1078-const closeArg = streamingInstances[0].close.mock.calls[0][0] as string;
1078+const closeArg = streamingInstances[0].close.mock.calls.at(0)?.[0] as string;
10791079expect(closeArg).toContain("> 💭 **Thinking**");
10801080expect(closeArg).toContain("> deep thought");
10811081expect(closeArg).not.toContain("Reasoning:");
@@ -1095,7 +1095,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
10951095await options.onIdle?.();
1096109610971097expect(streamingInstances).toHaveLength(1);
1098-const closeArg = streamingInstances[0].close.mock.calls[0][0] as string;
1098+const closeArg = streamingInstances[0].close.mock.calls.at(0)?.[0] as string;
10991099expect(closeArg).not.toContain("Thinking");
11001100expect(closeArg).toBe("```ts\ncode\n```");
11011101});
@@ -1432,7 +1432,7 @@ describe("createFeishuReplyDispatcher streaming behavior", () => {
14321432chatId: "oc_chat",
14331433});
143414341435-const options = createReplyDispatcherWithTypingMock.mock.calls[0]?.[0];
1435+const options = createReplyDispatcherWithTypingMock.mock.calls.at(0)?.[0];
1436143614371437// First deliver with markdown triggers startStreaming - which will fail
14381438await options.deliver({ text: "```ts\nconst x = 1\n```" }, { kind: "final" });
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。