
























@@ -20,6 +20,16 @@ import {
2020shouldSuggestMemorySystem,
2121} from "./doctor-workspace.js";
222223+async function expectPathMissing(targetPath: string): Promise<void> {
24+try {
25+await fs.access(targetPath);
26+} catch (error) {
27+expect((error as NodeJS.ErrnoException).code).toBe("ENOENT");
28+return;
29+}
30+throw new Error(`expected path to be missing: ${targetPath}`);
31+}
32+2333describe("root memory repair", () => {
2434let tmpDir = "";
2535@@ -68,9 +78,7 @@ describe("root memory repair", () => {
6878const canonical = await fs.readFile(path.join(tmpDir, "MEMORY.md"), "utf8");
6979expect(canonical).toContain("# Canonical");
7080expect(canonical).toContain("# Legacy");
71-await expect(fs.access(path.join(tmpDir, "memory.md"))).rejects.toMatchObject({
72-code: "ENOENT",
73-});
81+await expectPathMissing(path.join(tmpDir, "memory.md"));
7482if (migration.archivedLegacyPath === undefined) {
7583throw new Error("expected archived legacy memory path");
7684}
@@ -104,9 +112,7 @@ describe("root memory repair", () => {
104112});
105113const canonical = await fs.readFile(path.join(tmpDir, "MEMORY.md"), "utf8");
106114expect(canonical).toContain("# Legacy");
107-await expect(fs.access(path.join(tmpDir, "memory.md"))).rejects.toMatchObject({
108-code: "ENOENT",
109-});
115+await expectPathMissing(path.join(tmpDir, "memory.md"));
110116expect(note).toHaveBeenCalledWith(
111117expect.stringContaining("Workspace memory root merged:"),
112118"Doctor changes",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。