test: tighten image tempdir cleanup assertion

This commit is contained in:
Peter Steinberger
2026-05-09 08:43:12 +01:00
parent c605a0e6e8
commit 3cf5b8f7f5

View File

@@ -31,6 +31,13 @@ describe("image-ops temp dir", () => {
expect(prefix).toEqual(expect.stringMatching(/^.+openclaw-img-[0-9a-f-]+-$/u));
expect(path.dirname(prefix ?? "")).toBe(secureRoot);
expect(createdTempDir.startsWith(prefix ?? "")).toBe(true);
await expect(fs.access(createdTempDir)).rejects.toMatchObject({ code: "ENOENT" });
let accessError: unknown;
try {
await fs.access(createdTempDir);
} catch (error) {
accessError = error;
}
expect(accessError).toBeInstanceOf(Error);
expect((accessError as NodeJS.ErrnoException).code).toBe("ENOENT");
});
});