test: guard mixed extension mock calls · openclaw/openclaw@cce9a9e
steipete
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -93,7 +93,7 @@ describe("createMattermostDirectChannelWithRetry", () => {
|
93 | 93 | expect(result.id).toBe("dm-channel-456"); |
94 | 94 | expect(mockFetch).toHaveBeenCalledTimes(2); |
95 | 95 | expect(onRetry).toHaveBeenCalledTimes(1); |
96 | | -const retryCall = onRetry.mock.calls[0]; |
| 96 | +const retryCall = onRetry.mock.calls.at(0); |
97 | 97 | expect(retryCall?.[0]).toBe(1); |
98 | 98 | expect(retryCall?.[1]).toBeGreaterThanOrEqual(10); |
99 | 99 | expect(retryCall?.[1]).toBeLessThanOrEqual(20); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -236,7 +236,7 @@ describe("mattermost websocket monitor", () => {
|
236 | 236 | post_id: "post-1", |
237 | 237 | emoji_name: "thumbsup", |
238 | 238 | }); |
239 | | -const payload = onReaction.mock.calls[0]?.[0]; |
| 239 | +const payload = onReaction.mock.calls.at(0)?.[0]; |
240 | 240 | expect(payload).toEqual({ |
241 | 241 | event: "reaction_added", |
242 | 242 | data: { reaction }, |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -246,7 +246,7 @@ describe("mattermost setup", () => {
|
246 | 246 | } |
247 | 247 | |
248 | 248 | expect(registerHttpRoute).toHaveBeenCalledTimes(1); |
249 | | -const [route] = registerHttpRoute.mock.calls[0] ?? []; |
| 249 | +const [route] = registerHttpRoute.mock.calls.at(0) ?? []; |
250 | 250 | expect(route?.path).toBe("/api/channels/mattermost/command"); |
251 | 251 | expect(route?.auth).toBe("plugin"); |
252 | 252 | expect(typeof route?.handler).toBe("function"); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -2249,7 +2249,7 @@ describe("short-term dreaming trigger", () => {
|
2249 | 2249 | const dreamsText = await fs.readFile(path.join(workspaceDir, "DREAMS.md"), "utf-8"); |
2250 | 2250 | expect(dreamsText).toContain("A diary entry."); |
2251 | 2251 | }); |
2252 | | -expect(subagent.run.mock.calls[0]?.[0]?.model).toBe("anthropic/claude-sonnet-4-6"); |
| 2252 | +expect(subagent.run.mock.calls.at(0)?.[0]?.model).toBe("anthropic/claude-sonnet-4-6"); |
2253 | 2253 | }); |
2254 | 2254 | |
2255 | 2255 | it("skips dreaming promotion cleanly when limit is zero", async () => { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -411,7 +411,7 @@ describe("searchKeyword FTS MATCH fallback", () => {
|
411 | 411 | }); |
412 | 412 | |
413 | 413 | expect(warnSpy).toHaveBeenCalledTimes(1); |
414 | | -const [warning] = warnSpy.mock.calls[0] ?? []; |
| 414 | +const [warning] = warnSpy.mock.calls.at(0) ?? []; |
415 | 415 | expect(typeof warning).toBe("string"); |
416 | 416 | expect( |
417 | 417 | (warning as string | undefined)?.startsWith( |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -448,7 +448,7 @@ describe("memory plugin e2e", () => {
|
448 | 448 | expect(providerOptions.provider).toBe("openai"); |
449 | 449 | expect(providerOptions.fallback).toBe("none"); |
450 | 450 | expect(providerOptions.model).toBe("text-embedding-3-small"); |
451 | | -expect(createProvider.mock.calls[0][0]).not.toHaveProperty("remote"); |
| 451 | +expect(createProvider.mock.calls.at(0)?.[0]).not.toHaveProperty("remote"); |
452 | 452 | expect(embedQuery).toHaveBeenCalledWith("project memory"); |
453 | 453 | } finally { |
454 | 454 | vi.doUnmock("openclaw/plugin-sdk/memory-core-host-engine-embeddings"); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -49,7 +49,7 @@ describe("memory-wiki plugin", () => {
|
49 | 49 | "wiki_get", |
50 | 50 | ]); |
51 | 51 | expect(registerCli).toHaveBeenCalledTimes(1); |
52 | | -expect(registerCli.mock.calls[0]?.[1]).toStrictEqual({ |
| 52 | +expect(registerCli.mock.calls.at(0)?.[1]).toStrictEqual({ |
53 | 53 | descriptors: [ |
54 | 54 | { |
55 | 55 | name: "wiki", |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -270,7 +270,7 @@ describe("nextcloud-talk send cfg threading", () => {
|
270 | 270 | accountId: "work", |
271 | 271 | }); |
272 | 272 | expect(result?.receipt.platformMessageIds).toEqual(["22346"]); |
273 | | -const mediaSendCall = fetchMock.mock.calls[1]; |
| 273 | +const mediaSendCall = fetchMock.mock.calls.at(1); |
274 | 274 | expect(mediaSendCall?.[0]).toBe( |
275 | 275 | "https://nextcloud.example.com/ocs/v2.php/apps/spreed/api/v1/bot/abc123/message", |
276 | 276 | ); |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1205,7 +1205,7 @@ function createControlledNdjsonFetch(): {
|
1205 | 1205 | } |
1206 | 1206 | |
1207 | 1207 | function getGuardedFetchCall(fetchMock: typeof fetchWithSsrFGuardMock): GuardedFetchCall { |
1208 | | -return (fetchMock.mock.calls[0]?.[0] as GuardedFetchCall | undefined) ?? { url: "" }; |
| 1208 | +return (fetchMock.mock.calls.at(0)?.[0] as GuardedFetchCall | undefined) ?? { url: "" }; |
1209 | 1209 | } |
1210 | 1210 | |
1211 | 1211 | async function createOllamaTestStream(params: { |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -119,7 +119,7 @@ describe("wsl2 crash-loop check", () => {
|
119 | 119 | await checkWsl2CrashLoopRisk(logger); |
120 | 120 | |
121 | 121 | expect(logger.warn).toHaveBeenCalledTimes(1); |
122 | | -const message = String(logger.warn.mock.calls[0]?.[0]); |
| 122 | +const message = String(logger.warn.mock.calls.at(0)?.[0]); |
123 | 123 | expect(message).toContain("WSL2 crash-loop risk"); |
124 | 124 | expect(message).toContain("sudo systemctl disable ollama"); |
125 | 125 | expect(message).toContain("autoMemoryReclaim=disabled"); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。