test: tighten durable json error assertion · openclaw/openclaw@0a50556
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -61,10 +61,14 @@ describe("json file helpers", () => {
|
61 | 61 | |
62 | 62 | await expect(readDurableJsonFile(validPath)).resolves.toEqual({ ok: true }); |
63 | 63 | await expect(readDurableJsonFile(missingPath)).resolves.toBeNull(); |
64 | | -await expect(readDurableJsonFile(invalidPath)).rejects.toMatchObject({ |
65 | | -filePath: invalidPath, |
66 | | -reason: "parse", |
67 | | -} satisfies Partial<JsonFileReadError>); |
| 64 | +let readError: unknown; |
| 65 | +try { |
| 66 | +await readDurableJsonFile(invalidPath); |
| 67 | +} catch (error) { |
| 68 | +readError = error; |
| 69 | +} |
| 70 | +expect((readError as JsonFileReadError | undefined)?.filePath).toBe(invalidPath); |
| 71 | +expect((readError as JsonFileReadError | undefined)?.reason).toBe("parse"); |
68 | 72 | }); |
69 | 73 | }); |
70 | 74 | |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。