test: dedupe doctor workspace mock reads · openclaw/openclaw@6769b37
steipete
·
2026-05-13
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -30,6 +30,10 @@ async function expectPathMissing(targetPath: string): Promise<void> {
|
30 | 30 | throw new Error(`expected path to be missing: ${targetPath}`); |
31 | 31 | } |
32 | 32 | |
| 33 | +function firstNoteCall() { |
| 34 | +return note.mock.calls[0]; |
| 35 | +} |
| 36 | + |
33 | 37 | describe("root memory repair", () => { |
34 | 38 | let tmpDir = ""; |
35 | 39 | |
@@ -116,14 +120,15 @@ describe("root memory repair", () => {
|
116 | 120 | expect(canonical).toContain("# Legacy"); |
117 | 121 | await expectPathMissing(path.join(tmpDir, "memory.md")); |
118 | 122 | expect(note).toHaveBeenCalledTimes(1); |
119 | | -const repairMessage = String(note.mock.calls.at(0)?.[0] ?? ""); |
| 123 | +const repairNote = firstNoteCall(); |
| 124 | +const repairMessage = String(repairNote?.[0] ?? ""); |
120 | 125 | const repairLines = repairMessage.split("\n"); |
121 | 126 | expect(repairLines[0]).toBe("Workspace memory root merged:"); |
122 | 127 | expect(repairLines).toContain(`- canonical: ${path.join(tmpDir, "MEMORY.md")}`); |
123 | 128 | expect(repairLines).toContain( |
124 | 129 | `- merged legacy content from: ${path.join(tmpDir, "memory.md")}`, |
125 | 130 | ); |
126 | 131 | expect(repairLines).toContain(`- removed legacy file: ${path.join(tmpDir, "memory.md")}`); |
127 | | -expect(note.mock.calls.at(0)?.[1]).toBe("Doctor changes"); |
| 132 | +expect(repairNote?.[1]).toBe("Doctor changes"); |
128 | 133 | }); |
129 | 134 | }); |
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。