mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-18 12:08:52 +00:00
test: verify diagnostics and session callbacks
This commit is contained in:
@@ -20,7 +20,11 @@ describe("doctor include warning", () => {
|
||||
});
|
||||
|
||||
expect(noteSpy).toHaveBeenCalledWith(
|
||||
expect.stringContaining("$include paths must stay under:"),
|
||||
[
|
||||
"- $include paths must stay under: /tmp/openclaw-config",
|
||||
'- Move shared include files under that directory and update to relative paths like "./shared/common.json".',
|
||||
"- Error: Include path escapes config directory: /etc/passwd",
|
||||
].join("\n"),
|
||||
"Doctor warnings",
|
||||
);
|
||||
});
|
||||
|
||||
@@ -104,6 +104,8 @@ describe("config.openFile", () => {
|
||||
},
|
||||
undefined,
|
||||
);
|
||||
expect(logGateway.warn).toHaveBeenCalledWith(expect.stringContaining("spawn xdg-open ENOENT"));
|
||||
expect(logGateway.warn).toHaveBeenCalledWith(
|
||||
"config.openFile failed path=/tmp/config.json: spawn xdg-open ENOENT",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -117,7 +117,10 @@ describe("resolveSessionKeyFromResolveParams", () => {
|
||||
key: canonicalKey,
|
||||
});
|
||||
|
||||
expect(hoisted.updateSessionStoreMock).toHaveBeenCalledWith(storePath, expect.any(Function));
|
||||
expect(hoisted.updateSessionStoreMock).toHaveBeenCalledTimes(1);
|
||||
const updateSessionStoreCall = hoisted.updateSessionStoreMock.mock.calls[0];
|
||||
expect(updateSessionStoreCall?.[0]).toBe(storePath);
|
||||
expect(typeof updateSessionStoreCall?.[1]).toBe("function");
|
||||
expect(hoisted.listSessionsFromStoreMock).toHaveBeenCalledWith({
|
||||
cfg: {},
|
||||
storePath,
|
||||
|
||||
@@ -626,9 +626,7 @@ describe("discoverOpenClawPlugins", () => {
|
||||
discoverOpenClawPlugins({ env: buildDiscoveryEnv(stateDir) }),
|
||||
);
|
||||
|
||||
expect(result.diagnostics.map((entry) => entry.message)).not.toContainEqual(
|
||||
expect.stringContaining("pnpm install"),
|
||||
);
|
||||
expect(result.diagnostics.some((entry) => entry.message.includes("pnpm install"))).toBe(false);
|
||||
});
|
||||
|
||||
it("does not treat repo-level live or test files as plugin entrypoints", () => {
|
||||
|
||||
@@ -78,9 +78,7 @@ describe("hook correlation fields", () => {
|
||||
|
||||
await expect(run).resolves.toBeUndefined();
|
||||
expect(logger.error).toHaveBeenCalledWith(
|
||||
expect.stringContaining(
|
||||
"[hooks] agent_end handler from plugin-a failed: timed out after 5ms",
|
||||
),
|
||||
"[hooks] agent_end handler from plugin-a failed: timed out after 5ms",
|
||||
);
|
||||
} finally {
|
||||
vi.useRealTimers();
|
||||
|
||||
Reference in New Issue
Block a user