mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-13 23:56:07 +00:00
test: tighten crestodian assertions
This commit is contained in:
@@ -29,11 +29,10 @@ describe("Crestodian audit log", () => {
|
||||
expect(auditPath).toBe(resolveCrestodianAuditPath());
|
||||
const lines = (await fs.readFile(auditPath, "utf8")).trim().split("\n");
|
||||
expect(lines).toHaveLength(1);
|
||||
expect(JSON.parse(lines[0] ?? "{}")).toMatchObject({
|
||||
operation: "config.setDefaultModel",
|
||||
summary: "Set default model to openai/gpt-5.2",
|
||||
configHashBefore: "before",
|
||||
configHashAfter: "after",
|
||||
});
|
||||
const entry = JSON.parse(lines[0] ?? "{}") as Record<string, unknown>;
|
||||
expect(entry.operation).toBe("config.setDefaultModel");
|
||||
expect(entry.summary).toBe("Set default model to openai/gpt-5.2");
|
||||
expect(entry.configHashBefore).toBe("before");
|
||||
expect(entry.configHashAfter).toBe("after");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -52,19 +52,15 @@ describe("loadCrestodianOverview", () => {
|
||||
},
|
||||
});
|
||||
|
||||
expect(overview.config).toMatchObject({
|
||||
exists: true,
|
||||
valid: true,
|
||||
});
|
||||
expect(overview.config.exists).toBe(true);
|
||||
expect(overview.config.valid).toBe(true);
|
||||
expect(overview.defaultAgentId).toBe("main");
|
||||
expect(overview.defaultModel).toBe("openai/gpt-5.2");
|
||||
expect(overview.agents.map((agent) => agent.id)).toEqual(["main", "work"]);
|
||||
expect(overview.tools.codex.found).toBe(true);
|
||||
expect(overview.tools.claude.found).toBe(false);
|
||||
expect(overview.gateway).toMatchObject({
|
||||
url: "ws://127.0.0.1:19001",
|
||||
reachable: false,
|
||||
});
|
||||
expect(overview.gateway.url).toBe("ws://127.0.0.1:19001");
|
||||
expect(overview.gateway.reachable).toBe(false);
|
||||
expect(overview.references.docsPath).toMatch(/docs$/);
|
||||
expect(overview.references.sourceUrl).toBe("https://github.com/openclaw/openclaw");
|
||||
expect(formatCrestodianOverview(overview)).toContain(
|
||||
|
||||
@@ -98,11 +98,14 @@ describeLive("Crestodian live rescue channel smoke", () => {
|
||||
);
|
||||
|
||||
const config = JSON.parse(await fs.readFile(configPath, "utf8")) as OpenClawConfig;
|
||||
expect(config.agents?.defaults?.model).toMatchObject({ primary: "openai/gpt-5.5" });
|
||||
const defaultModel = config.agents?.defaults?.model;
|
||||
expect(typeof defaultModel).toBe("object");
|
||||
expect(defaultModel).not.toBeNull();
|
||||
expect((defaultModel as { primary?: unknown }).primary).toBe("openai/gpt-5.5");
|
||||
const auditPath = path.join(tempDir, "audit", "crestodian.jsonl");
|
||||
const auditLines = (await fs.readFile(auditPath, "utf8")).trim().split("\n");
|
||||
expect(auditLines).toEqual(
|
||||
expect.arrayContaining([expect.stringContaining('"operation":"config.setDefaultModel"')]),
|
||||
expect(auditLines.some((line) => line.includes('"operation":"config.setDefaultModel"'))).toBe(
|
||||
true,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -55,13 +55,20 @@ describe("runCrestodianTui", () => {
|
||||
);
|
||||
|
||||
expect(runTuiCalls).toBe(1);
|
||||
expect(runTuiOptions).toMatchObject({
|
||||
local: true,
|
||||
session: "agent:crestodian:main",
|
||||
historyLimit: 200,
|
||||
config: {},
|
||||
title: "openclaw crestodian",
|
||||
});
|
||||
expect(runTuiOptions).toMatchObject({ backend: expect.any(Object) });
|
||||
const options = runTuiOptions as {
|
||||
local?: boolean;
|
||||
session?: string;
|
||||
historyLimit?: number;
|
||||
config?: unknown;
|
||||
title?: string;
|
||||
backend?: unknown;
|
||||
};
|
||||
expect(options.local).toBe(true);
|
||||
expect(options.session).toBe("agent:crestodian:main");
|
||||
expect(options.historyLimit).toBe(200);
|
||||
expect(options.config).toEqual({});
|
||||
expect(options.title).toBe("openclaw crestodian");
|
||||
expect(typeof options.backend).toBe("object");
|
||||
expect(options.backend).not.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user