test: guard plugin sdk mock calls · openclaw/openclaw@3f5557f
steipete
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -161,7 +161,7 @@ describe("discord plugin-sdk facade", () => {
|
161 | 161 | }); |
162 | 162 | |
163 | 163 | expect(mocks.runtimeModule.autoBindSpawnedDiscordSubagent).toHaveBeenCalledTimes(1); |
164 | | -const callParams = mocks.runtimeModule.autoBindSpawnedDiscordSubagent.mock.calls[0]?.[0]; |
| 164 | +const callParams = mocks.runtimeModule.autoBindSpawnedDiscordSubagent.mock.calls.at(0)?.[0]; |
165 | 165 | expect(callParams.agentId).toBe("agent"); |
166 | 166 | expect(callParams.cfg).toBe(mocks.runtimeConfig); |
167 | 167 | expect(callParams.childSessionKey).toBe("child"); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -144,9 +144,9 @@ describe("fetchWithBearerAuthScopeFallback", () => {
|
144 | 144 | expect(response.status).toBe(200); |
145 | 145 | expect(fetchFn).toHaveBeenCalledTimes(2); |
146 | 146 | expect( |
147 | | -Object.getOwnPropertySymbols(fetchFn.mock.calls[0]?.[1]?.headers as object), |
| 147 | +Object.getOwnPropertySymbols(fetchFn.mock.calls.at(0)?.[1]?.headers as object), |
148 | 148 | ).toStrictEqual([]); |
149 | | -expect(new Headers(fetchFn.mock.calls[1]?.[1]?.headers).get("authorization")).toBe( |
| 149 | +expect(new Headers(fetchFn.mock.calls.at(1)?.[1]?.headers).get("authorization")).toBe( |
150 | 150 | "Bearer token-1", |
151 | 151 | ); |
152 | 152 | expect(Object.getOwnPropertySymbols(headers)).toHaveLength(1); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -39,7 +39,7 @@ import {
|
39 | 39 | } from "./inbound-reply-dispatch.js"; |
40 | 40 | |
41 | 41 | function readFirstMockArg(fn: unknown): unknown { |
42 | | -return (fn as { mock: { calls: unknown[][] } }).mock.calls[0]?.[0]; |
| 42 | +return (fn as { mock: { calls: unknown[][] } }).mock.calls.at(0)?.[0]; |
43 | 43 | } |
44 | 44 | |
45 | 45 | describe("recordInboundSessionAndDispatchReply", () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -81,7 +81,7 @@ describe("plugin-sdk qa-runner-runtime", () => {
|
81 | 81 | const module = await import("./qa-runner-runtime.js"); |
82 | 82 | |
83 | 83 | expect(module.loadQaRunnerBundledPluginTestApi("matrix")).toBe(testApi); |
84 | | -const testApiCall = loadBundledPluginPublicSurfaceModuleSync.mock.calls[0]?.[0] as |
| 84 | +const testApiCall = loadBundledPluginPublicSurfaceModuleSync.mock.calls.at(0)?.[0] as |
85 | 85 | | { artifactBasename?: string; dirName?: string; env?: NodeJS.ProcessEnv } |
86 | 86 | | undefined; |
87 | 87 | expect(testApiCall?.dirName).toBe("matrix"); |
@@ -202,15 +202,15 @@ describe("plugin-sdk qa-runner-runtime", () => {
|
202 | 202 | }, |
203 | 203 | }, |
204 | 204 | ]); |
205 | | -const manifestCall = loadPluginManifestRegistry.mock.calls[0]?.[0] as |
| 205 | +const manifestCall = loadPluginManifestRegistry.mock.calls.at(0)?.[0] as |
206 | 206 | | { env?: NodeJS.ProcessEnv } |
207 | 207 | | undefined; |
208 | 208 | expect(manifestCall?.env?.OPENCLAW_ENABLE_PRIVATE_QA_CLI).toBe("1"); |
209 | 209 | expect(manifestCall?.env?.OPENCLAW_BUNDLED_PLUGINS_DIR).toBe( |
210 | 210 | path.join(sourceRoot, "extensions"), |
211 | 211 | ); |
212 | 212 | |
213 | | -const publicSurfaceCall = loadBundledPluginPublicSurfaceModuleSync.mock.calls[0]?.[0] as |
| 213 | +const publicSurfaceCall = loadBundledPluginPublicSurfaceModuleSync.mock.calls.at(0)?.[0] as |
214 | 214 | | { dirName?: string; artifactBasename?: string; env?: NodeJS.ProcessEnv } |
215 | 215 | | undefined; |
216 | 216 | expect(publicSurfaceCall?.dirName).toBe("qa-matrix"); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。