From e8049fec1ccf2af22c738cdc17f54ae0e41d595e Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 9 May 2026 02:50:33 +0100 Subject: [PATCH] test: tighten backup archive absence assertion --- src/commands/backup.atomic.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/commands/backup.atomic.test.ts b/src/commands/backup.atomic.test.ts index 3f519f57fe1..baf38c1efba 100644 --- a/src/commands/backup.atomic.test.ts +++ b/src/commands/backup.atomic.test.ts @@ -55,6 +55,10 @@ describe("backupCreateCommand atomic archive write", () => { }; } + async function expectPathMissing(targetPath: string): Promise { + await expect(fs.access(targetPath)).rejects.toMatchObject({ code: "ENOENT" }); + } + it("does not leave a partial final archive behind when tar creation fails", async () => { const { archiveDir, outputPath, runtime } = await prepareAtomicBackupScenario({ archivePrefix: "openclaw-backup-failure-", @@ -68,7 +72,7 @@ describe("backupCreateCommand atomic archive write", () => { }), ).rejects.toThrow(/disk full/i); - await expect(fs.access(outputPath)).rejects.toThrow(); + await expectPathMissing(outputPath); const remaining = await fs.readdir(archiveDir); expect(remaining).toEqual([]); } finally {