test: tighten session write lock assertions · openclaw/openclaw@5ab7a45
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -24,7 +24,13 @@ async function expectLockRemovedOnlyAfterFinalRelease(params: {
|
24 | 24 | } |
25 | 25 | |
26 | 26 | async function expectPathMissing(targetPath: string): Promise<void> { |
27 | | -await expect(fs.access(targetPath)).rejects.toMatchObject({ code: "ENOENT" }); |
| 27 | +try { |
| 28 | +await fs.access(targetPath); |
| 29 | +} catch (error) { |
| 30 | +expect((error as NodeJS.ErrnoException).code).toBe("ENOENT"); |
| 31 | +return; |
| 32 | +} |
| 33 | +throw new Error(`Expected path to be missing: ${targetPath}`); |
28 | 34 | } |
29 | 35 | |
30 | 36 | async function expectCurrentPidOwnsLock(params: { |
@@ -273,7 +279,8 @@ describe("acquireSessionWriteLock", () => {
|
273 | 279 | staleMs: 60_000, |
274 | 280 | }); |
275 | 281 | const raw = await fs.readFile(lockPath, "utf8"); |
276 | | -expect(JSON.parse(raw)).toMatchObject({ pid: process.pid }); |
| 282 | +const payload = JSON.parse(raw) as { pid?: unknown }; |
| 283 | +expect(payload.pid).toBe(process.pid); |
277 | 284 | await lock.release(); |
278 | 285 | }); |
279 | 286 | }); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。