test: guard cron infra ui mock calls · openclaw/openclaw@81b7d67
steipete
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -80,7 +80,7 @@ describe("sendFailureNotificationAnnounce", () => {
|
80 | 80 | sessionKey: "cron:job-1:failure", |
81 | 81 | }); |
82 | 82 | expect(mocks.deliverOutboundPayloads).toHaveBeenCalledTimes(1); |
83 | | -const [deliveryRequest] = mocks.deliverOutboundPayloads.mock.calls[0] as [ |
| 83 | +const [deliveryRequest] = mocks.deliverOutboundPayloads.mock.calls.at(0) as [ |
84 | 84 | { |
85 | 85 | abortSignal?: unknown; |
86 | 86 | accountId?: string; |
@@ -171,7 +171,7 @@ describe("sendFailureNotificationAnnounce", () => {
|
171 | 171 | ).resolves.toBeUndefined(); |
172 | 172 | |
173 | 173 | expect(mocks.warn).toHaveBeenCalledTimes(1); |
174 | | -const [warnMeta, warnMessage] = mocks.warn.mock.calls[0] as [ |
| 174 | +const [warnMeta, warnMessage] = mocks.warn.mock.calls.at(0) as [ |
175 | 175 | { channel?: string; err?: string; to?: string }, |
176 | 176 | string, |
177 | 177 | ]; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -76,11 +76,11 @@ describe("withExtractedArchiveRoot", () => {
|
76 | 76 | }); |
77 | 77 | |
78 | 78 | expect(withTempDirSpy).toHaveBeenCalledTimes(1); |
79 | | -const withTempDirCall = withTempDirSpy.mock.calls[0]; |
| 79 | +const withTempDirCall = withTempDirSpy.mock.calls.at(0); |
80 | 80 | expect(withTempDirCall?.[0]).toBe("openclaw-plugin-"); |
81 | 81 | expect(typeof withTempDirCall?.[1]).toBe("function"); |
82 | 82 | expect(extractSpy).toHaveBeenCalledOnce(); |
83 | | -expect(extractSpy.mock.calls[0]?.[0]?.archivePath).toBe(archivePath); |
| 83 | +expect(extractSpy.mock.calls.at(0)?.[0]?.archivePath).toBe(archivePath); |
84 | 84 | expect(resolveRootSpy).toHaveBeenCalledWith(extractDir, { |
85 | 85 | rootMarkers: ["package.json"], |
86 | 86 | }); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -160,7 +160,7 @@ describe("push-apns.relay", () => {
|
160 | 160 | }); |
161 | 161 | |
162 | 162 | expect(sender).toHaveBeenCalledTimes(1); |
163 | | -const sent = sender.mock.calls[0]?.[0] as |
| 163 | +const sent = sender.mock.calls.at(0)?.[0] as |
164 | 164 | | { |
165 | 165 | relayConfig?: { baseUrl?: string; timeoutMs?: number }; |
166 | 166 | sendGrant?: string; |
@@ -221,7 +221,7 @@ describe("push-apns.relay", () => {
|
221 | 221 | const result = await sendApnsRelayPush(createRelayPushParams()); |
222 | 222 | |
223 | 223 | expect(fetchMock).toHaveBeenCalledTimes(1); |
224 | | -const fetchOptions = fetchMock.mock.calls[0]?.[1] as { redirect?: unknown } | undefined; |
| 224 | +const fetchOptions = fetchMock.mock.calls.at(0)?.[1] as { redirect?: unknown } | undefined; |
225 | 225 | expect(fetchOptions?.redirect).toBe("manual"); |
226 | 226 | expect(result.ok).toBe(false); |
227 | 227 | expect(result.status).toBe(302); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -847,7 +847,7 @@ describe("run-node script", () => {
|
847 | 847 | |
848 | 848 | expect(exitCode).toBe(0); |
849 | 849 | expect(runRuntimePostBuild).toHaveBeenCalledTimes(1); |
850 | | -const postBuildParams = runRuntimePostBuild.mock.calls[0]?.[0] as |
| 850 | +const postBuildParams = runRuntimePostBuild.mock.calls.at(0)?.[0] as |
851 | 851 | | { cwd?: string; env?: Record<string, string | undefined> } |
852 | 852 | | undefined; |
853 | 853 | expect(postBuildParams?.cwd).toBe(tmp); |
@@ -1328,7 +1328,9 @@ describe("run-node script", () => {
|
1328 | 1328 | |
1329 | 1329 | expect(exitCode).toBe(143); |
1330 | 1330 | expect(spawn).toHaveBeenCalledTimes(1); |
1331 | | -const spawnCall = spawn.mock.calls[0] as [string, string[], { stdio?: unknown }] | undefined; |
| 1331 | +const spawnCall = spawn.mock.calls.at(0) as |
| 1332 | +| [string, string[], { stdio?: unknown }] |
| 1333 | +| undefined; |
1332 | 1334 | expect(spawnCall?.[0]).toBe(process.execPath); |
1333 | 1335 | expect(spawnCall?.[1]).toEqual(["openclaw.mjs", "status"]); |
1334 | 1336 | expect(spawnCall?.[2].stdio).toBe("inherit"); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -316,8 +316,8 @@ describe("loadControlUiBootstrapConfig", () => {
|
316 | 316 | await loadControlUiBootstrapConfig(state); |
317 | 317 | |
318 | 318 | expect(fetchMock).toHaveBeenCalledTimes(2); |
319 | | -const [, firstInit] = fetchMock.mock.calls[0] ?? []; |
320 | | -const [, secondInit] = fetchMock.mock.calls[1] ?? []; |
| 319 | +const [, firstInit] = fetchMock.mock.calls.at(0) ?? []; |
| 320 | +const [, secondInit] = fetchMock.mock.calls.at(1) ?? []; |
321 | 321 | expect((firstInit?.headers as Record<string, string> | undefined)?.Authorization).toBe( |
322 | 322 | "Bearer stale-token", |
323 | 323 | ); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。