test: tighten backup archive absence assertion

This commit is contained in:
Peter Steinberger
2026-05-09 02:50:33 +01:00
parent ecc7e3c7b5
commit e8049fec1c

View File

@@ -55,6 +55,10 @@ describe("backupCreateCommand atomic archive write", () => {
};
}
async function expectPathMissing(targetPath: string): Promise<void> {
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 {