test: guard status command mock calls · openclaw/openclaw@17863b0
steipete
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -191,7 +191,7 @@ describe("resolveNonInteractiveApiKey", () => {
|
191 | 191 | |
192 | 192 | expect(result).toEqual({ key: "custom-profile-key", source: "profile" }); |
193 | 193 | expect(resolveApiKeyForProfile).toHaveBeenCalledOnce(); |
194 | | -const [profileParams] = resolveApiKeyForProfile.mock.calls[0] ?? []; |
| 194 | +const [profileParams] = resolveApiKeyForProfile.mock.calls.at(0) ?? []; |
195 | 195 | expect(profileParams?.profileId).toBe("custom-models-custom-local:default"); |
196 | 196 | }); |
197 | 197 | }); |
| Original file line number | Diff line number | Diff line change |
|---|
@@ -127,7 +127,7 @@ describe("applyNonInteractiveAuthChoice", () => {
|
127 | 127 | "custom-models-custom-local/local-large", |
128 | 128 | ); |
129 | 129 | expect(resolveNonInteractiveApiKey).toHaveBeenCalledOnce(); |
130 | | -const [apiKeyParams] = resolveNonInteractiveApiKey.mock.calls[0] ?? []; |
| 130 | +const [apiKeyParams] = resolveNonInteractiveApiKey.mock.calls.at(0) ?? []; |
131 | 131 | expect(apiKeyParams?.provider).toBe("custom-models-custom-local"); |
132 | 132 | expect(apiKeyParams?.flagName).toBe("--custom-api-key"); |
133 | 133 | expect(apiKeyParams?.envVar).toBe("CUSTOM_API_KEY"); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -76,7 +76,7 @@ describe("installGatewayDaemonNonInteractive", () => {
|
76 | 76 | |
77 | 77 | expect(resolveGatewayInstallToken).toHaveBeenCalledTimes(1); |
78 | 78 | expect(buildGatewayInstallPlan).toHaveBeenCalledTimes(1); |
79 | | -expect("token" in buildGatewayInstallPlan.mock.calls[0][0]).toBe(false); |
| 79 | +expect("token" in buildGatewayInstallPlan.mock.calls.at(0)?.[0]).toBe(false); |
80 | 80 | expect(serviceInstall).toHaveBeenCalledTimes(1); |
81 | 81 | }); |
82 | 82 | |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -152,7 +152,7 @@ describe("sandboxListCommand", () => {
|
152 | 152 | |
153 | 153 | await sandboxListCommand({ browser: false, json: true }, runtime as never); |
154 | 154 | |
155 | | -const loggedJson = runtime.log.mock.calls[0][0]; |
| 155 | +const loggedJson = runtime.log.mock.calls.at(0)?.[0]; |
156 | 156 | const parsed = JSON.parse(loggedJson); |
157 | 157 | |
158 | 158 | expect(parsed).toStrictEqual({ |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -74,7 +74,7 @@ describe("buildStatusAllReportLines", () => {
|
74 | 74 | expect(output).toContain("PRESENT"); |
75 | 75 | expect(output).toContain("ABSENT"); |
76 | 76 | expect(diagnosisSpy).toHaveBeenCalledOnce(); |
77 | | -const [diagnosisOptions] = diagnosisSpy.mock.calls[0] as unknown as [ |
| 77 | +const [diagnosisOptions] = diagnosisSpy.mock.calls.at(0) as unknown as [ |
78 | 78 | { secretDiagnostics?: unknown[] }, |
79 | 79 | ]; |
80 | 80 | expect(diagnosisOptions?.secretDiagnostics).toEqual([]); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -120,7 +120,7 @@ describe("statusJsonCommand", () => {
|
120 | 120 | await statusJsonCommand({ all: true }, runtime); |
121 | 121 | |
122 | 122 | expect(mocks.runSecurityAudit).toHaveBeenCalledOnce(); |
123 | | -const auditInput = mocks.runSecurityAudit.mock.calls[0]?.[0] as |
| 123 | +const auditInput = mocks.runSecurityAudit.mock.calls.at(0)?.[0] as |
124 | 124 | | { |
125 | 125 | config?: unknown; |
126 | 126 | sourceConfig?: unknown; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1025,7 +1025,7 @@ describe("statusCommand", () => {
|
1025 | 1025 | const allPayload = JSON.parse(getRuntimeLog(0)); |
1026 | 1026 | expect(allPayload.securityAudit.summary.critical).toBe(1); |
1027 | 1027 | expect(allPayload.securityAudit.summary.warn).toBe(1); |
1028 | | -const auditParams = mocks.runSecurityAudit.mock.calls[0]?.[0]; |
| 1028 | +const auditParams = mocks.runSecurityAudit.mock.calls.at(0)?.[0]; |
1029 | 1029 | expect(auditParams?.includeFilesystem).toBe(true); |
1030 | 1030 | expect(auditParams?.includeChannelSecurity).toBe(true); |
1031 | 1031 | }); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。