diff --git a/src/commands/doctor-session-locks.test.ts b/src/commands/doctor-session-locks.test.ts index 6e6381e7016..9891a86e9be 100644 --- a/src/commands/doctor-session-locks.test.ts +++ b/src/commands/doctor-session-locks.test.ts @@ -14,6 +14,10 @@ vi.mock("../terminal/note.js", () => ({ import { noteSessionLockHealth } from "./doctor-session-locks.js"; +async function expectPathMissing(targetPath: string): Promise { + await expect(fs.access(targetPath)).rejects.toMatchObject({ code: "ENOENT" }); +} + describe("noteSessionLockHealth", () => { let state: OpenClawTestState; @@ -75,7 +79,7 @@ describe("noteSessionLockHealth", () => { expect(message).toContain("[removed]"); expect(message).toContain("Removed 1 stale session lock file"); - await expect(fs.access(staleLock)).rejects.toThrow(); + await expectPathMissing(staleLock); await expect(fs.access(freshLock)).resolves.toBeUndefined(); }); });