test: guard remaining agent mock calls · openclaw/openclaw@e16b80a
steipete
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -98,7 +98,7 @@ describe("AgentRuntimePlan tool policy helpers", () => {
|
98 | 98 | |
99 | 99 | expect(normalized[0]?.parameters).toEqual(normalizedParameterFreeSchema()); |
100 | 100 | expect(mocks.normalizeProviderToolSchemas).toHaveBeenCalledTimes(1); |
101 | | -expect(mocks.normalizeProviderToolSchemas.mock.calls[0]?.[0]).toEqual({ |
| 101 | +expect(mocks.normalizeProviderToolSchemas.mock.calls.at(0)?.[0]).toEqual({ |
102 | 102 | tools: [createParameterFreeTool()], |
103 | 103 | provider: "openai", |
104 | 104 | config: undefined, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -354,7 +354,7 @@ describe("prepareSimpleCompletionModel", () => {
|
354 | 354 | modelId: "chat-local", |
355 | 355 | }); |
356 | 356 | |
357 | | -const overrideCall = hoisted.applyLocalNoAuthHeaderOverrideMock.mock.calls[0]; |
| 357 | +const overrideCall = hoisted.applyLocalNoAuthHeaderOverrideMock.mock.calls.at(0); |
358 | 358 | expect((overrideCall?.[0] as { provider?: string; id?: string } | undefined)?.provider).toBe( |
359 | 359 | "local-openai", |
360 | 360 | ); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -81,7 +81,7 @@ describe("prepareModelForSimpleCompletion", () => {
|
81 | 81 | }); |
82 | 82 | |
83 | 83 | expect(resolveProviderStreamFn).toHaveBeenCalledTimes(1); |
84 | | -const [request] = resolveProviderStreamFn.mock.calls[0] as [ |
| 84 | +const [request] = resolveProviderStreamFn.mock.calls.at(0) as [ |
85 | 85 | { |
86 | 86 | provider?: unknown; |
87 | 87 | config?: unknown; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -37,7 +37,7 @@ const { installSkillFromClawHub, searchSkillsFromClawHub, updateSkillsFromClawHu
|
37 | 37 | await import("./skills-clawhub.js"); |
38 | 38 | |
39 | 39 | function expectInstallPackageSourceDir(sourceDir: string) { |
40 | | -const call = installPackageDirMock.mock.calls[0]; |
| 40 | +const call = installPackageDirMock.mock.calls.at(0); |
41 | 41 | if (!call) { |
42 | 42 | throw new Error("expected installPackageDir call"); |
43 | 43 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -722,7 +722,7 @@ describe("subagent registry persistence", () => {
|
722 | 722 | await waitForRegistryWork(() => vi.mocked(callGateway).mock.calls.length > 0); |
723 | 723 | |
724 | 724 | expect(callGateway).toHaveBeenCalledTimes(1); |
725 | | -const [request] = vi.mocked(callGateway).mock.calls[0] ?? []; |
| 725 | +const [request] = vi.mocked(callGateway).mock.calls.at(0) ?? []; |
726 | 726 | expectFields(request, { method: "agent.wait" }); |
727 | 727 | expectFields((request as { params?: unknown } | undefined)?.params, { runId }); |
728 | 728 | expect( |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -469,7 +469,7 @@ describe("subagent registry seam flow", () => {
|
469 | 469 | "function", |
470 | 470 | ); |
471 | 471 | |
472 | | -const updateStore = mocks.updateSessionStore.mock.calls[0]?.[1] as |
| 472 | +const updateStore = mocks.updateSessionStore.mock.calls.at(0)?.[1] as |
473 | 473 | | ((store: Record<string, Record<string, unknown>>) => void) |
474 | 474 | | undefined; |
475 | 475 | expect(updateStore).toBeTypeOf("function"); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -402,7 +402,7 @@ describe("resolveEffectiveToolInventory", () => {
|
402 | 402 | }); |
403 | 403 | |
404 | 404 | expect(createToolsMock).toHaveBeenCalledTimes(1); |
405 | | -const createToolsOptions = createToolsMock.mock.calls[0]?.[0]; |
| 405 | +const createToolsOptions = createToolsMock.mock.calls.at(0)?.[0]; |
406 | 406 | expect(createToolsOptions?.allowGatewaySubagentBinding).toBe(true); |
407 | 407 | expect(createToolsOptions?.modelCompat).toEqual({ |
408 | 408 | supportsTools: true, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -154,7 +154,7 @@ describe("transport params runtime contract (Pi/OpenAI path)", () => {
|
154 | 154 | expect(prepared?.preparedByProvider).toBe(true); |
155 | 155 | expect(prepared?.parallel_tool_calls).toBe(false); |
156 | 156 | expect(prepared?.transportHookApplied).toBe(true); |
157 | | -const transportInput = resolveProviderExtraParamsForTransport.mock.calls[0]?.[0] as |
| 157 | +const transportInput = resolveProviderExtraParamsForTransport.mock.calls.at(0)?.[0] as |
158 | 158 | | { |
159 | 159 | context?: { |
160 | 160 | extraParams?: { preparedByProvider?: boolean }; |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。