test: guard plugin install mock calls · openclaw/openclaw@4336340
steipete
·
2026-05-12
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -324,7 +324,7 @@ function requireRecord(value: unknown, label: string): Record<string, unknown> {
|
324 | 324 | } |
325 | 325 | |
326 | 326 | function requireHookPayload(handler: ReturnType<typeof vi.fn>): Record<string, unknown> { |
327 | | -const payload = handler.mock.calls[0]?.[0]; |
| 327 | +const payload = handler.mock.calls.at(0)?.[0]; |
328 | 328 | return requireRecord(payload, "before_install hook payload"); |
329 | 329 | } |
330 | 330 | |
@@ -664,7 +664,7 @@ describe("installPluginFromArchive", () => {
|
664 | 664 | }); |
665 | 665 | |
666 | 666 | expect(result.ok).toBe(true); |
667 | | -const commandRun = vi.mocked(runCommandWithTimeout).mock.calls[0]; |
| 667 | +const commandRun = vi.mocked(runCommandWithTimeout).mock.calls.at(0); |
668 | 668 | expect(commandRun?.[0]).toContain("npm"); |
669 | 669 | expect(commandRun?.[0]).toContain("install"); |
670 | 670 | const commandOptions = commandRun?.[1]; |
@@ -2412,7 +2412,7 @@ describe("installPluginFromArchive", () => {
|
2412 | 2412 | version: "1.0.0", |
2413 | 2413 | extensions: ["index.js"], |
2414 | 2414 | }); |
2415 | | -expect(handler.mock.calls[0]?.[1]).toEqual({ |
| 2415 | +expect(handler.mock.calls.at(0)?.[1]).toEqual({ |
2416 | 2416 | origin: "plugin-package", |
2417 | 2417 | targetType: "plugin", |
2418 | 2418 | requestKind: "plugin-dir", |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。