test: clarify command e2e assertions · openclaw/openclaw@0ae3c84
steipete
·
2026-05-08
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -44,18 +44,17 @@ describe("doctor command", () => {
|
44 | 44 | |
45 | 45 | await doctorCommand(createDoctorRuntime(), { nonInteractive: true }); |
46 | 46 | |
47 | | -expect( |
48 | | -terminalNoteMock.mock.calls.some(([message, title]) => { |
49 | | -if (title !== "Sandbox" || typeof message !== "string") { |
50 | | -return false; |
51 | | -} |
52 | | -const normalized = message.replace(/\s+/g, " ").trim(); |
53 | | -return ( |
54 | | -normalized.includes('agents.list (id "work") sandbox docker') && |
55 | | -normalized.includes('scope resolves to "shared"') |
56 | | -); |
57 | | -}), |
58 | | -).toBe(true); |
| 47 | +const matchingSandboxNotes = terminalNoteMock.mock.calls.filter(([message, title]) => { |
| 48 | +if (title !== "Sandbox" || typeof message !== "string") { |
| 49 | +return false; |
| 50 | +} |
| 51 | +const normalized = message.replace(/\s+/g, " ").trim(); |
| 52 | +return ( |
| 53 | +normalized.includes('agents.list (id "work") sandbox docker') && |
| 54 | +normalized.includes('scope resolves to "shared"') |
| 55 | +); |
| 56 | +}); |
| 57 | +expect(matchingSandboxNotes.length).toBeGreaterThan(0); |
59 | 58 | }, 30_000); |
60 | 59 | |
61 | 60 | it("does not warn when only the active workspace is present", async () => { |
@@ -82,9 +81,8 @@ describe("doctor command", () => {
|
82 | 81 | |
83 | 82 | await doctorCommand(createDoctorRuntime(), { nonInteractive: true }); |
84 | 83 | |
85 | | -expect(terminalNoteMock.mock.calls.some(([_, title]) => title === "Extra workspace")).toBe( |
86 | | -false, |
87 | | -); |
| 84 | +const noteTitles = terminalNoteMock.mock.calls.map(([_, title]) => title); |
| 85 | +expect(noteTitles).not.toContain("Extra workspace"); |
88 | 86 | |
89 | 87 | homedirSpy.mockRestore(); |
90 | 88 | existsSpy.mockRestore(); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。