























@@ -51,7 +51,7 @@ function mockCallArg<T>(
5151argIndex: number,
5252_type?: (value: unknown) => value is T,
5353): T {
54-const call = mock.mock.calls[callIndex];
54+const call = mock.mock.calls.at(callIndex);
5555if (!call) {
5656throw new Error(`Expected mock call at index ${callIndex}`);
5757}
@@ -140,7 +140,7 @@ describe("registerFeishuDriveTools", () => {
140140);
141141142142expect(registerTool).toHaveBeenCalledTimes(1);
143-const toolFactory = registerTool.mock.calls[0]?.[0];
143+const toolFactory = registerTool.mock.calls.at(0)?.[0];
144144const tool = toolFactory?.({ agentAccountId: undefined });
145145expect(tool?.name).toBe("feishu_drive");
146146@@ -358,7 +358,7 @@ describe("registerFeishuDriveTools", () => {
358358}),
359359);
360360361-const toolFactory = registerTool.mock.calls[0]?.[0];
361+const toolFactory = registerTool.mock.calls.at(0)?.[0];
362362const tool = toolFactory?.({ agentAccountId: undefined });
363363364364requestMock.mockResolvedValueOnce({
@@ -379,7 +379,7 @@ describe("registerFeishuDriveTools", () => {
379379file_type: "docx",
380380reply_elements: [{ type: "text", text: "defaulted file type" }],
381381});
382-expect(infoSpy.mock.calls[0]?.[0]).toContain(
382+expect(infoSpy.mock.calls.at(0)?.[0]).toContain(
383383"add_comment missing file_type; defaulting to docx",
384384);
385385expect((result.details as { comment_id?: string; success?: boolean }).success).toBe(true);
@@ -405,7 +405,7 @@ describe("registerFeishuDriveTools", () => {
405405}),
406406);
407407408-const toolFactory = registerTool.mock.calls[0]?.[0];
408+const toolFactory = registerTool.mock.calls.at(0)?.[0];
409409const tool = toolFactory?.({ agentAccountId: undefined });
410410411411requestMock.mockResolvedValueOnce({
@@ -423,7 +423,7 @@ describe("registerFeishuDriveTools", () => {
423423expect(request.url).toBe(
424424"/open-apis/drive/v1/files/doc_1/comments?file_type=docx&user_id_type=open_id",
425425);
426-expect(infoSpy.mock.calls[0]?.[0]).toContain(
426+expect(infoSpy.mock.calls.at(0)?.[0]).toContain(
427427"list_comments missing file_type; defaulting to docx",
428428);
429429});
@@ -447,7 +447,7 @@ describe("registerFeishuDriveTools", () => {
447447}),
448448);
449449450-const toolFactory = registerTool.mock.calls[0]?.[0];
450+const toolFactory = registerTool.mock.calls.at(0)?.[0];
451451const tool = toolFactory?.({ agentAccountId: undefined });
452452453453requestMock.mockResolvedValueOnce({
@@ -466,7 +466,7 @@ describe("registerFeishuDriveTools", () => {
466466expect(request.url).toBe(
467467"/open-apis/drive/v1/files/doc_1/comments/c1/replies?file_type=docx&user_id_type=open_id",
468468);
469-expect(infoSpy.mock.calls[0]?.[0]).toContain(
469+expect(infoSpy.mock.calls.at(0)?.[0]).toContain(
470470"list_comment_replies missing file_type; defaulting to docx",
471471);
472472});
@@ -490,7 +490,7 @@ describe("registerFeishuDriveTools", () => {
490490}),
491491);
492492493-const toolFactory = registerTool.mock.calls[0]?.[0];
493+const toolFactory = registerTool.mock.calls.at(0)?.[0];
494494const tool = toolFactory?.({ agentAccountId: undefined });
495495496496requestMock
@@ -548,7 +548,7 @@ describe("registerFeishuDriveTools", () => {
548548],
549549},
550550});
551-expect(warnSpy.mock.calls[0]?.[0]).toContain("replyComment threw");
551+expect(warnSpy.mock.calls.at(0)?.[0]).toContain("replyComment threw");
552552expect((replyCommentResult.details as { error?: string }).error).toBe(
553553"Request failed with status code 400",
554554);
@@ -572,7 +572,7 @@ describe("registerFeishuDriveTools", () => {
572572}),
573573);
574574575-const toolFactory = registerTool.mock.calls[0]?.[0];
575+const toolFactory = registerTool.mock.calls.at(0)?.[0];
576576const tool = toolFactory?.({
577577agentAccountId: undefined,
578578deliveryContext: {
@@ -670,7 +670,7 @@ describe("registerFeishuDriveTools", () => {
670670}),
671671);
672672673-const toolFactory = registerTool.mock.calls[0]?.[0];
673+const toolFactory = registerTool.mock.calls.at(0)?.[0];
674674const tool = toolFactory?.({
675675agentAccountId: undefined,
676676deliveryContext: {
@@ -747,7 +747,7 @@ describe("registerFeishuDriveTools", () => {
747747}),
748748);
749749750-const toolFactory = registerTool.mock.calls[0]?.[0];
750+const toolFactory = registerTool.mock.calls.at(0)?.[0];
751751const tool = toolFactory?.({
752752agentAccountId: undefined,
753753deliveryContext: {
@@ -774,7 +774,7 @@ describe("registerFeishuDriveTools", () => {
774774file_type: "docx",
775775reply_elements: [{ type: "text", text: "default add comment" }],
776776});
777-expect(infoSpy.mock.calls[0]?.[0]).toContain(
777+expect(infoSpy.mock.calls.at(0)?.[0]).toContain(
778778"add_comment missing file_type; defaulting to docx",
779779);
780780expect((result.details as { comment_id?: string; success?: boolean }).success).toBe(true);
@@ -800,7 +800,7 @@ describe("registerFeishuDriveTools", () => {
800800}),
801801);
802802803-const toolFactory = registerTool.mock.calls[0]?.[0];
803+const toolFactory = registerTool.mock.calls.at(0)?.[0];
804804const tool = toolFactory?.({ agentAccountId: undefined });
805805806806requestMock
@@ -844,7 +844,7 @@ describe("registerFeishuDriveTools", () => {
844844},
845845},
846846});
847-expect(infoSpy.mock.calls[0]?.[0]).toContain(
847+expect(infoSpy.mock.calls.at(0)?.[0]).toContain(
848848"reply_comment missing file_type; defaulting to docx",
849849);
850850expect((result.details as { reply_id?: string; success?: boolean }).success).toBe(true);
@@ -870,7 +870,7 @@ describe("registerFeishuDriveTools", () => {
870870}),
871871);
872872873-const toolFactory = registerTool.mock.calls[0]?.[0];
873+const toolFactory = registerTool.mock.calls.at(0)?.[0];
874874const tool = toolFactory?.({ agentAccountId: undefined });
875875876876requestMock
@@ -906,7 +906,7 @@ describe("registerFeishuDriveTools", () => {
906906reply_elements: [{ type: "text", text: "whole comment follow-up" }],
907907},
908908});
909-expect(infoSpy.mock.calls[0]?.[0]).toContain("whole-comment compatibility path");
909+expect(infoSpy.mock.calls.at(0)?.[0]).toContain("whole-comment compatibility path");
910910const details = result.details as {
911911comment_id?: string;
912912delivery_mode?: string;
@@ -936,7 +936,7 @@ describe("registerFeishuDriveTools", () => {
936936}),
937937);
938938939-const toolFactory = registerTool.mock.calls[0]?.[0];
939+const toolFactory = registerTool.mock.calls.at(0)?.[0];
940940const tool = toolFactory?.({ agentAccountId: undefined });
941941942942requestMock.mockRejectedValueOnce(new Error("preflight unavailable")).mockResolvedValueOnce({
@@ -974,7 +974,7 @@ describe("registerFeishuDriveTools", () => {
974974},
975975},
976976});
977-expect(warnSpy.mock.calls[0]?.[0]).toContain("comment metadata preflight failed");
977+expect(warnSpy.mock.calls.at(0)?.[0]).toContain("comment metadata preflight failed");
978978const details = result.details as {
979979delivery_mode?: string;
980980reply_id?: string;
@@ -1004,7 +1004,7 @@ describe("registerFeishuDriveTools", () => {
10041004}),
10051005);
100610061007-const toolFactory = registerTool.mock.calls[0]?.[0];
1007+const toolFactory = registerTool.mock.calls.at(0)?.[0];
10081008const tool = toolFactory?.({ agentAccountId: undefined });
1009100910101010requestMock
@@ -1083,7 +1083,7 @@ describe("registerFeishuDriveTools", () => {
10831083}),
10841084);
108510851086-const toolFactory = registerTool.mock.calls[0]?.[0];
1086+const toolFactory = registerTool.mock.calls.at(0)?.[0];
10871087const tool = toolFactory?.({ agentAccountId: undefined });
1088108810891089requestMock
@@ -1131,7 +1131,7 @@ describe("registerFeishuDriveTools", () => {
11311131reply_elements: [{ type: "text", text: "compat follow-up" }],
11321132},
11331133});
1134-expect(infoSpy.mock.calls[0]?.[0]).toContain("reply-not-allowed compatibility path");
1134+expect(infoSpy.mock.calls.at(0)?.[0]).toContain("reply-not-allowed compatibility path");
11351135const details = result.details as {
11361136comment_id?: string;
11371137delivery_mode?: string;
@@ -1160,7 +1160,7 @@ describe("registerFeishuDriveTools", () => {
11601160}),
11611161);
116211621163-const toolFactory = registerTool.mock.calls[0]?.[0];
1163+const toolFactory = registerTool.mock.calls.at(0)?.[0];
11641164const tool = toolFactory?.({ agentAccountId: undefined });
1165116511661166requestMock.mockResolvedValueOnce({ code: 0, data: { has_more: false, items: [] } });
@@ -1207,7 +1207,7 @@ describe("registerFeishuDriveTools", () => {
12071207}),
12081208);
120912091210-const toolFactory = registerTool.mock.calls[0]?.[0];
1210+const toolFactory = registerTool.mock.calls.at(0)?.[0];
12111211const tool = toolFactory?.({ agentAccountId: undefined });
12121212const result = await tool.execute("call-5", {
12131213action: "add_comment",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。