test: tighten dreaming repair assertions · openclaw/openclaw@337d584
shakkernerd
·
2026-05-11
·
via Recent Commits to openclaw:main
File tree
extensions/memory-core/src
| Original file line number | Diff line number | Diff line change |
|---|
@@ -20,6 +20,17 @@ function requireArchiveDir(archiveDir: string | undefined): string {
|
20 | 20 | return archiveDir; |
21 | 21 | } |
22 | 22 | |
| 23 | +async function expectPathMissing(targetPath: string): Promise<void> { |
| 24 | +let error: unknown; |
| 25 | +try { |
| 26 | +await fs.access(targetPath); |
| 27 | +} catch (caught) { |
| 28 | +error = caught; |
| 29 | +} |
| 30 | +expect(error).toBeInstanceOf(Error); |
| 31 | +expect((error as NodeJS.ErrnoException).code).toBe("ENOENT"); |
| 32 | +} |
| 33 | + |
23 | 34 | afterEach(async () => { |
24 | 35 | while (tempDirs.length > 0) { |
25 | 36 | const dir = tempDirs.pop(); |
@@ -127,10 +138,8 @@ describe("dreaming artifact repair", () => {
|
127 | 138 | expect(archiveDir).toBe( |
128 | 139 | path.join(workspaceDir, ".openclaw-repair", "dreaming", "2026-04-11T21-30-00-000Z"), |
129 | 140 | ); |
130 | | -await expect(fs.access(sessionCorpusDir)).rejects.toMatchObject({ code: "ENOENT" }); |
131 | | -await expect( |
132 | | -fs.access(path.join(workspaceDir, "memory", ".dreams", "session-ingestion.json")), |
133 | | -).rejects.toMatchObject({ code: "ENOENT" }); |
| 141 | +await expectPathMissing(sessionCorpusDir); |
| 142 | +await expectPathMissing(path.join(workspaceDir, "memory", ".dreams", "session-ingestion.json")); |
134 | 143 | await expect(fs.readFile(dreamsPath, "utf-8")).resolves.toContain("# Dream Diary"); |
135 | 144 | const archivedEntries = await fs.readdir(archiveDir); |
136 | 145 | expect(archivedEntries).toContainEqual(expect.stringMatching(/^session-corpus\./)); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。