
























@@ -31,7 +31,7 @@ describe("handleControlUiHttpRequest", () => {
3131}
32323333function parseBootstrapPayload(end: ReturnType<typeof makeMockHttpResponse>["end"]) {
34-return JSON.parse(String(end.mock.calls[0]?.[0] ?? "")) as {
34+return JSON.parse(String(end.mock.calls.at(0)?.[0] ?? "")) as {
3535basePath: string;
3636assistantName: string;
3737assistantAvatar: string;
@@ -214,7 +214,7 @@ describe("handleControlUiHttpRequest", () => {
214214}) {
215215expect(params.handled).toBe(true);
216216expect(params.res.statusCode).toBe(403);
217-expect(JSON.parse(String(params.end.mock.calls[0]?.[0] ?? ""))).toEqual({
217+expect(JSON.parse(String(params.end.mock.calls.at(0)?.[0] ?? ""))).toEqual({
218218ok: false,
219219error: {
220220type: "forbidden",
@@ -372,7 +372,7 @@ describe("handleControlUiHttpRequest", () => {
372372});
373373expect(handled).toBe(true);
374374expect(res.statusCode).toBe(200);
375-const payload = JSON.parse(String(end.mock.calls[0]?.[0] ?? "")) as {
375+const payload = JSON.parse(String(end.mock.calls.at(0)?.[0] ?? "")) as {
376376available?: boolean;
377377mediaTicket?: string;
378378mediaTicketExpiresAt?: string;
@@ -414,7 +414,7 @@ describe("handleControlUiHttpRequest", () => {
414414});
415415expect(handled).toBe(true);
416416expect(res.statusCode).toBe(200);
417-const payload = JSON.parse(String(end.mock.calls[0]?.[0] ?? "")) as {
417+const payload = JSON.parse(String(end.mock.calls.at(0)?.[0] ?? "")) as {
418418available?: boolean;
419419mediaTicket?: string;
420420mediaTicketExpiresAt?: string;
@@ -440,7 +440,7 @@ describe("handleControlUiHttpRequest", () => {
440440authorization: "Bearer test-token",
441441},
442442});
443-const payload = JSON.parse(String(meta.end.mock.calls[0]?.[0] ?? "")) as {
443+const payload = JSON.parse(String(meta.end.mock.calls.at(0)?.[0] ?? "")) as {
444444mediaTicket?: string;
445445};
446446expect(meta.handled).toBe(true);
@@ -472,7 +472,7 @@ describe("handleControlUiHttpRequest", () => {
472472authorization: "Bearer test-token",
473473},
474474});
475-const payload = JSON.parse(String(meta.end.mock.calls[0]?.[0] ?? "")) as {
475+const payload = JSON.parse(String(meta.end.mock.calls.at(0)?.[0] ?? "")) as {
476476mediaTicket?: string;
477477};
478478@@ -483,7 +483,7 @@ describe("handleControlUiHttpRequest", () => {
483483});
484484expect(refresh.handled).toBe(true);
485485expect(refresh.res.statusCode).toBe(401);
486-expect(String(refresh.end.mock.calls[0]?.[0] ?? "")).toContain("Unauthorized");
486+expect(String(refresh.end.mock.calls.at(0)?.[0] ?? "")).toContain("Unauthorized");
487487},
488488});
489489});
@@ -501,7 +501,7 @@ describe("handleControlUiHttpRequest", () => {
501501});
502502expect(handled).toBe(true);
503503expect(res.statusCode).toBe(401);
504-expect(String(end.mock.calls[0]?.[0] ?? "")).toContain("Unauthorized");
504+expect(String(end.mock.calls.at(0)?.[0] ?? "")).toContain("Unauthorized");
505505},
506506});
507507});
@@ -514,7 +514,7 @@ describe("handleControlUiHttpRequest", () => {
514514});
515515expect(handled).toBe(true);
516516expect(res.statusCode).toBe(200);
517-expect(JSON.parse(String(end.mock.calls[0]?.[0] ?? ""))).toEqual({
517+expect(JSON.parse(String(end.mock.calls.at(0)?.[0] ?? ""))).toEqual({
518518available: false,
519519code: "outside-allowed-folders",
520520reason: "Outside allowed folders",
@@ -534,7 +534,7 @@ describe("handleControlUiHttpRequest", () => {
534534});
535535expect(handled).toBe(true);
536536expect(res.statusCode).toBe(401);
537-expect(String(end.mock.calls[0]?.[0] ?? "")).toContain("Unauthorized");
537+expect(String(end.mock.calls.at(0)?.[0] ?? "")).toContain("Unauthorized");
538538},
539539});
540540});
@@ -598,7 +598,7 @@ describe("handleControlUiHttpRequest", () => {
598598});
599599expect(handled).toBe(true);
600600expect(res.statusCode).toBe(401);
601-expect(String(end.mock.calls[0]?.[0] ?? "")).toContain("Unauthorized");
601+expect(String(end.mock.calls.at(0)?.[0] ?? "")).toContain("Unauthorized");
602602},
603603});
604604});
@@ -719,7 +719,7 @@ describe("handleControlUiHttpRequest", () => {
719719});
720720expect(handled).toBe(true);
721721expect(res.statusCode).toBe(401);
722-expect(String(end.mock.calls[0]?.[0] ?? "")).toContain("Unauthorized");
722+expect(String(end.mock.calls.at(0)?.[0] ?? "")).toContain("Unauthorized");
723723},
724724});
725725});
@@ -805,7 +805,7 @@ describe("handleControlUiHttpRequest", () => {
805805806806expect(handled).toBe(true);
807807expect(res.statusCode).toBe(200);
808-expect(String(end.mock.calls[0]?.[0] ?? "")).toBe("avatar-bytes\n");
808+expect(String(end.mock.calls.at(0)?.[0] ?? "")).toBe("avatar-bytes\n");
809809} finally {
810810await fs.rm(tmp, { recursive: true, force: true });
811811}
@@ -876,7 +876,7 @@ describe("handleControlUiHttpRequest", () => {
876876877877expect(handled).toBe(true);
878878expect(res.statusCode).toBe(200);
879-expect(String(end.mock.calls[0]?.[0] ?? "")).toBe("avatar-bytes\n");
879+expect(String(end.mock.calls.at(0)?.[0] ?? "")).toBe("avatar-bytes\n");
880880} finally {
881881await fs.rm(tmp, { recursive: true, force: true });
882882}
@@ -901,7 +901,7 @@ describe("handleControlUiHttpRequest", () => {
901901902902expect(handled).toBe(true);
903903expect(res.statusCode).toBe(200);
904-expect(JSON.parse(String(end.mock.calls[0]?.[0] ?? ""))).toEqual({
904+expect(JSON.parse(String(end.mock.calls.at(0)?.[0] ?? ""))).toEqual({
905905avatarUrl: "https://example.com/avatar.png",
906906avatarSource: "remote URL",
907907avatarStatus: "remote",
@@ -922,7 +922,7 @@ describe("handleControlUiHttpRequest", () => {
922922923923expect(handled).toBe(true);
924924expect(res.statusCode).toBe(200);
925-expect(JSON.parse(String(end.mock.calls[0]?.[0] ?? ""))).toEqual({
925+expect(JSON.parse(String(end.mock.calls.at(0)?.[0] ?? ""))).toEqual({
926926avatarUrl: null,
927927avatarSource: null,
928928avatarStatus: "none",
@@ -940,7 +940,7 @@ describe("handleControlUiHttpRequest", () => {
940940941941expect(handled).toBe(true);
942942expect(res.statusCode).toBe(401);
943-expect(String(end.mock.calls[0]?.[0] ?? "")).toContain("Unauthorized");
943+expect(String(end.mock.calls.at(0)?.[0] ?? "")).toContain("Unauthorized");
944944});
945945946946it("rejects trusted-proxy avatar metadata requests without operator.read scope", async () => {
@@ -995,7 +995,7 @@ describe("handleControlUiHttpRequest", () => {
995995996996expect(handled).toBe(true);
997997expect(res.statusCode).toBe(200);
998-expect(String(end.mock.calls[0]?.[0] ?? "")).toBe("inside-ok\n");
998+expect(String(end.mock.calls.at(0)?.[0] ?? "")).toBe("inside-ok\n");
999999},
10001000});
10011001});
@@ -1013,7 +1013,7 @@ describe("handleControlUiHttpRequest", () => {
1013101310141014expect(handled).toBe(true);
10151015expect(res.statusCode).toBe(200);
1016-expect(end.mock.calls[0]?.length ?? -1).toBe(0);
1016+expect(end.mock.calls.at(0)?.length ?? -1).toBe(0);
10171017},
10181018});
10191019});
@@ -1096,7 +1096,7 @@ describe("handleControlUiHttpRequest", () => {
1096109610971097expect(handled).toBe(true);
10981098expect(res.statusCode).toBe(200);
1099-expect(String(end.mock.calls[0]?.[0] ?? "")).toBe("console.log('hi');");
1099+expect(String(end.mock.calls.at(0)?.[0] ?? "")).toBe("console.log('hi');");
11001100},
11011101});
11021102});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。