
























@@ -44,7 +44,7 @@ describe("system-cli", () => {
4444it("runs system event with default wake mode and text output", async () => {
4545await runCli(["system", "event", "--text", " hello world "]);
464647-const [method, payload, options, requestOptions] = callGatewayFromCli.mock.calls[0] ?? [];
47+const [method, payload, options, requestOptions] = callGatewayFromCli.mock.calls.at(0) ?? [];
4848expect(method).toBe("wake");
4949expect((payload as { text?: string } | undefined)?.text).toBe(" hello world ");
5050expect(options).toEqual({ mode: "next-heartbeat", text: "hello world" });
@@ -78,7 +78,8 @@ describe("system-cli", () => {
7878]);
79798080expect(callGatewayFromCli).toHaveBeenCalledTimes(1);
81-const [method, gatewayOptions, params, requestOptions] = callGatewayFromCli.mock.calls[0] ?? [];
81+const [method, gatewayOptions, params, requestOptions] =
82+callGatewayFromCli.mock.calls.at(0) ?? [];
8283expect(method).toBe("wake");
8384expect(typeof gatewayOptions).toBe("object");
8485expect(params).toEqual({
@@ -93,15 +94,15 @@ describe("system-cli", () => {
9394await runCli(["system", "event", "--text", "ping"]);
94959596expect(callGatewayFromCli).toHaveBeenCalledTimes(1);
96-const [, , params] = callGatewayFromCli.mock.calls[0];
97+const [, , params] = callGatewayFromCli.mock.calls.at(0) ?? [];
9798expect(params).not.toHaveProperty("sessionKey");
9899});
99100100101it("treats empty --session-key as omitted", async () => {
101102await runCli(["system", "event", "--text", "ping", "--session-key", " "]);
102103103104expect(callGatewayFromCli).toHaveBeenCalledTimes(1);
104-const [, , params] = callGatewayFromCli.mock.calls[0];
105+const [, , params] = callGatewayFromCli.mock.calls.at(0) ?? [];
105106expect(params).not.toHaveProperty("sessionKey");
106107});
107108@@ -125,7 +126,7 @@ describe("system-cli", () => {
125126126127expect(callGatewayFromCli).toHaveBeenCalledTimes(1);
127128const [calledMethod, gatewayOptions, calledParams, requestOptions] =
128-callGatewayFromCli.mock.calls[0] ?? [];
129+callGatewayFromCli.mock.calls.at(0) ?? [];
129130expect(calledMethod).toBe(method);
130131expect(typeof gatewayOptions).toBe("object");
131132expect(calledParams).toEqual(params);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。