test: tighten host cleanup assertions · openclaw/openclaw@02567a8
shakkernerd
·
2026-05-11
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -28,8 +28,9 @@ describe("plugin host cleanup config fallback", () => {
|
28 | 28 | cleanup, |
29 | 29 | }, |
30 | 30 | }); |
| 31 | +const configError = new Error("invalid config"); |
31 | 32 | mocks.getRuntimeConfig.mockImplementation(() => { |
32 | | -throw new Error("invalid config"); |
| 33 | +throw configError; |
33 | 34 | }); |
34 | 35 | |
35 | 36 | const result = await runPluginHostCleanup({ |
@@ -38,17 +39,22 @@ describe("plugin host cleanup config fallback", () => {
|
38 | 39 | reason: "disable", |
39 | 40 | }); |
40 | 41 | |
41 | | -expect(cleanup).toHaveBeenCalledWith( |
42 | | -expect.objectContaining({ |
43 | | -reason: "disable", |
44 | | -}), |
45 | | -); |
| 42 | +expect(cleanup.mock.calls).toEqual([ |
| 43 | +[ |
| 44 | +{ |
| 45 | +runId: undefined, |
| 46 | +reason: "disable", |
| 47 | +sessionKey: undefined, |
| 48 | +}, |
| 49 | +], |
| 50 | +]); |
46 | 51 | expect(result.cleanupCount).toBe(1); |
47 | 52 | expect(result.failures).toEqual([ |
48 | | -expect.objectContaining({ |
| 53 | +{ |
| 54 | +error: configError, |
49 | 55 | pluginId: "cleanup-plugin", |
50 | 56 | hookId: "session-store", |
51 | | -}), |
| 57 | +}, |
52 | 58 | ]); |
53 | 59 | }); |
54 | 60 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。