test: tighten archive json error assertion · openclaw/openclaw@da0e949
steipete
·
2026-05-09
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -8,7 +8,7 @@ import {
|
8 | 8 | resolvePackedRootDir, |
9 | 9 | } from "./archive.js"; |
10 | 10 | import { pathExists, withTimeout } from "./fs-safe.js"; |
11 | | -import { readJsonFileStrict } from "./json-files.js"; |
| 11 | +import { JsonFileReadError, readJsonFileStrict } from "./json-files.js"; |
12 | 12 | |
13 | 13 | const tempDirs = createTrackedTempDirs(); |
14 | 14 | const createTempDir = () => tempDirs.make("openclaw-archive-helper-test-"); |
@@ -159,7 +159,7 @@ describe("archive helpers", () => {
|
159 | 159 | await fs.writeFile(badPath, "{not json", "utf8"); |
160 | 160 | |
161 | 161 | await expect(readJsonFileStrict<{ ok: boolean }>(jsonPath)).resolves.toEqual({ ok: true }); |
162 | | -await expect(readJsonFileStrict(badPath)).rejects.toThrow(); |
| 162 | +await expect(readJsonFileStrict(badPath)).rejects.toBeInstanceOf(JsonFileReadError); |
163 | 163 | await expect(pathExists(jsonPath)).resolves.toBe(true); |
164 | 164 | await expect(pathExists(path.join(dir, "missing.json"))).resolves.toBe(false); |
165 | 165 | }); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。