From e8f798e5061a338ba16a78474be499dadf22bec4 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 9 May 2026 02:22:24 +0100 Subject: [PATCH] test: dedupe clawhub cleanup absence assertions --- src/infra/clawhub.test.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/infra/clawhub.test.ts b/src/infra/clawhub.test.ts index 45e8d85b61c..53a457ba728 100644 --- a/src/infra/clawhub.test.ts +++ b/src/infra/clawhub.test.ts @@ -20,6 +20,10 @@ import { searchClawHubSkills, } from "./clawhub.js"; +async function expectPathMissing(targetPath: string): Promise { + await expect(fs.stat(targetPath)).rejects.toMatchObject({ code: "ENOENT" }); +} + describe("clawhub helpers", () => { const originalHome = process.env.HOME; @@ -359,7 +363,7 @@ describe("clawhub helpers", () => { } finally { const archiveDir = path.dirname(archive.archivePath); await archive.cleanup(); - await expect(fs.stat(archiveDir)).rejects.toThrow(); + await expectPathMissing(archiveDir); } }); @@ -398,7 +402,7 @@ describe("clawhub helpers", () => { } finally { const archiveDir = path.dirname(archive.archivePath); await archive.cleanup(); - await expect(fs.stat(archiveDir)).rejects.toThrow(); + await expectPathMissing(archiveDir); } }); @@ -497,7 +501,7 @@ describe("clawhub helpers", () => { } finally { const archiveDir = path.dirname(archive.archivePath); await archive.cleanup(); - await expect(fs.stat(archiveDir)).rejects.toThrow(); + await expectPathMissing(archiveDir); } }); });