@@ -31,6 +31,10 @@ function pointerFile(sessionId: string, runtimeFile: string): string {
|
31 | 31 | })}\n`; |
32 | 32 | } |
33 | 33 | |
| 34 | +async function expectPathMissing(targetPath: string): Promise<void> { |
| 35 | +await expect(fs.stat(targetPath)).rejects.toMatchObject({ code: "ENOENT" }); |
| 36 | +} |
| 37 | + |
34 | 38 | describe("trajectory cleanup", () => { |
35 | 39 | it("removes adjacent trajectory sidecars for a deleted session", async () => { |
36 | 40 | await withTempDir({ prefix: "openclaw-trajectory-cleanup-" }, async (dir) => { |
@@ -50,8 +54,8 @@ describe("trajectory cleanup", () => {
|
50 | 54 | }); |
51 | 55 | |
52 | 56 | expect(removed.map((entry) => entry.kind).toSorted()).toEqual(["pointer", "runtime"]); |
53 | | -await expect(fs.stat(runtimeFile)).rejects.toThrow(); |
54 | | -await expect(fs.stat(pointerPath)).rejects.toThrow(); |
| 57 | +await expectPathMissing(runtimeFile); |
| 58 | +await expectPathMissing(pointerPath); |
55 | 59 | }); |
56 | 60 | }); |
57 | 61 | |
@@ -101,8 +105,8 @@ describe("trajectory cleanup", () => {
|
101 | 105 | restrictToStoreDir: true, |
102 | 106 | }); |
103 | 107 | |
104 | | -await expect(fs.stat(safeExternalRuntime)).rejects.toThrow(); |
105 | | -await expect(fs.stat(pointerPath)).rejects.toThrow(); |
| 108 | +await expectPathMissing(safeExternalRuntime); |
| 109 | +await expectPathMissing(pointerPath); |
106 | 110 | |
107 | 111 | await fs.writeFile(pointerPath, pointerFile(sessionId, unsafeExternalRuntime), "utf8"); |
108 | 112 | await removeSessionTrajectoryArtifacts({ |
|