test: tighten config validation log assertion · openclaw/openclaw@c5cc6d6
shakkernerd
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -45,6 +45,15 @@ describe("requireValidConfigSnapshot", () => {
|
45 | 45 | }; |
46 | 46 | } |
47 | 47 | |
| 48 | +function requireFirstLog(runtime: ReturnType<typeof createRuntime>): string { |
| 49 | +const [message] = runtime.log.mock.calls[0] ?? []; |
| 50 | +expect(message).toBeDefined(); |
| 51 | +if (message === undefined) { |
| 52 | +throw new Error("expected runtime log message"); |
| 53 | +} |
| 54 | +return String(message); |
| 55 | +} |
| 56 | + |
48 | 57 | it("returns config without emitting compatibility advice by default", async () => { |
49 | 58 | createValidSnapshot(); |
50 | 59 | const runtime = createRuntime(); |
@@ -69,10 +78,9 @@ describe("requireValidConfigSnapshot", () => {
|
69 | 78 | expect(config).toEqual({ plugins: {} }); |
70 | 79 | expect(runtime.error).not.toHaveBeenCalled(); |
71 | 80 | expect(runtime.exit).not.toHaveBeenCalled(); |
72 | | -expect(String(runtime.log.mock.calls[0]?.[0])).toContain("Plugin compatibility: 1 notice."); |
73 | | -expect(String(runtime.log.mock.calls[0]?.[0])).toContain( |
74 | | -"legacy-plugin still uses legacy before_agent_start", |
75 | | -); |
| 81 | +const logMessage = requireFirstLog(runtime); |
| 82 | +expect(logMessage).toContain("Plugin compatibility: 1 notice."); |
| 83 | +expect(logMessage).toContain("legacy-plugin still uses legacy before_agent_start"); |
76 | 84 | }); |
77 | 85 | |
78 | 86 | it("blocks invalid config before emitting compatibility advice", async () => { |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。