



























@@ -14,6 +14,10 @@ async function expectPathExists(targetPath: string): Promise<void> {
1414await expect(fs.access(targetPath)).resolves.toBeUndefined();
1515}
161617+async function expectPathMissing(targetPath: string): Promise<void> {
18+await expect(fs.stat(targetPath)).rejects.toMatchObject({ code: "ENOENT" });
19+}
20+1721describe("enforceSessionDiskBudget", () => {
1822it("does not treat referenced transcripts with marker-like session IDs as archived artifacts", async () => {
1923await withTempDir({ prefix: "openclaw-disk-budget-" }, async (dir) => {
@@ -80,7 +84,7 @@ describe("enforceSessionDiskBudget", () => {
8084});
81858286await expectPathExists(transcriptPath);
83-await expect(fs.stat(archivePath)).rejects.toThrow();
87+await expectPathMissing(archivePath);
8488expect(result).toEqual(
8589expect.objectContaining({
8690removedFiles: 1,
@@ -140,7 +144,7 @@ describe("enforceSessionDiskBudget", () => {
140144});
141145142146await expectPathExists(transcriptPath);
143-await expect(fs.stat(checkpointPath)).rejects.toThrow();
147+await expectPathMissing(checkpointPath);
144148await expectPathExists(referencedCheckpointPath);
145149expect(result).toEqual(
146150expect.objectContaining({
@@ -190,8 +194,8 @@ describe("enforceSessionDiskBudget", () => {
190194await expectPathExists(transcriptPath);
191195await expectPathExists(referencedRuntime);
192196await expectPathExists(referencedPointer);
193-await expect(fs.stat(orphanRuntime)).rejects.toThrow();
194-await expect(fs.stat(orphanPointer)).rejects.toThrow();
197+await expectPathMissing(orphanRuntime);
198+await expectPathMissing(orphanPointer);
195199expect(result).toEqual(
196200expect.objectContaining({
197201removedFiles: 2,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。