mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-12 13:10:43 +00:00
test: tighten archive json error assertion
This commit is contained in:
@@ -8,7 +8,7 @@ import {
|
||||
resolvePackedRootDir,
|
||||
} from "./archive.js";
|
||||
import { pathExists, withTimeout } from "./fs-safe.js";
|
||||
import { readJsonFileStrict } from "./json-files.js";
|
||||
import { JsonFileReadError, readJsonFileStrict } from "./json-files.js";
|
||||
|
||||
const tempDirs = createTrackedTempDirs();
|
||||
const createTempDir = () => tempDirs.make("openclaw-archive-helper-test-");
|
||||
@@ -159,7 +159,7 @@ describe("archive helpers", () => {
|
||||
await fs.writeFile(badPath, "{not json", "utf8");
|
||||
|
||||
await expect(readJsonFileStrict<{ ok: boolean }>(jsonPath)).resolves.toEqual({ ok: true });
|
||||
await expect(readJsonFileStrict(badPath)).rejects.toThrow();
|
||||
await expect(readJsonFileStrict(badPath)).rejects.toBeInstanceOf(JsonFileReadError);
|
||||
await expect(pathExists(jsonPath)).resolves.toBe(true);
|
||||
await expect(pathExists(path.join(dir, "missing.json"))).resolves.toBe(false);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user