test: dedupe clawhub cleanup absence assertions

This commit is contained in:
Peter Steinberger
2026-05-09 02:22:24 +01:00
parent 0a52fd17a3
commit e8f798e506

View File

@@ -20,6 +20,10 @@ import {
searchClawHubSkills,
} from "./clawhub.js";
async function expectPathMissing(targetPath: string): Promise<void> {
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);
}
});
});