test: tighten openclaw test instance assertions

This commit is contained in:
Peter Steinberger
2026-05-09 08:37:07 +01:00
parent d2ac6c3dd5
commit ad75cb661c

View File

@@ -4,7 +4,13 @@ import { describe, expect, it } from "vitest";
import { createOpenClawTestInstance } from "./openclaw-test-instance.js";
async function expectPathMissing(targetPath: string): Promise<void> {
await expect(fs.stat(targetPath)).rejects.toMatchObject({ code: "ENOENT" });
try {
await fs.stat(targetPath);
} catch (error) {
expect((error as NodeJS.ErrnoException).code).toBe("ENOENT");
return;
}
throw new Error(`Expected missing path: ${targetPath}`);
}
describe("openclaw test instance", () => {
@@ -35,7 +41,7 @@ describe("openclaw test instance", () => {
expect(inst.env.OPENCLAW_SKIP_CRON).toBe("0");
const config = JSON.parse(await fs.readFile(inst.configPath, "utf8"));
expect(config).toMatchObject({
expect(config).toStrictEqual({
gateway: {
bind: "loopback",
port: inst.port,