From 2f50bb71ef5dc9a4a1e649dd749bf7f367ef8315 Mon Sep 17 00:00:00 2001 From: Shakker Date: Sat, 9 May 2026 02:44:49 +0100 Subject: [PATCH] test: tighten session lock absence assertion --- src/commands/doctor-session-locks.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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(); }); });