test(cron): cover owner-only tool availability

This commit is contained in:
Peter Steinberger 2026-03-09 05:52:04 +00:00 committed by Vincent Koc
parent 0d607942d5
commit d6b26e22d5

View File

@ -1,4 +1,6 @@
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import "../../agents/test-helpers/fast-coding-tools.js";
import { createOpenClawCodingTools } from "../../agents/pi-tools.js";
import {
clearFastTestEnv,
loadRunCronIsolatedAgentTurn,
@ -54,6 +56,11 @@ describe("runCronIsolatedAgentTurn owner auth", () => {
await runCronIsolatedAgentTurn(makeParams());
expect(runEmbeddedPiAgentMock).toHaveBeenCalledTimes(1);
expect(runEmbeddedPiAgentMock.mock.calls[0]?.[0]?.senderIsOwner).toBe(true);
const senderIsOwner = runEmbeddedPiAgentMock.mock.calls[0]?.[0]?.senderIsOwner;
expect(senderIsOwner).toBe(true);
const toolNames = createOpenClawCodingTools({ senderIsOwner }).map((tool) => tool.name);
expect(toolNames).toContain("cron");
expect(toolNames).toContain("gateway");
});
});