mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-19 11:18:37 +00:00
test(cron): add empty-skills edge case for skill filter coverage
Addresses Greptile review feedback: locks in behavior when an agent has skills: [] (explicit empty list), ensuring skillFilter: [] is forwarded to buildWorkspaceSkillSnapshot to filter out all skills.
This commit is contained in:
committed by
Peter Steinberger
parent
053affffec
commit
e5dbfde7e1
@@ -253,4 +253,22 @@ describe("runCronIsolatedAgentTurn — skill filter", () => {
|
|||||||
// When no skills config, skillFilter should be undefined (no filtering applied)
|
// When no skills config, skillFilter should be undefined (no filtering applied)
|
||||||
expect(buildWorkspaceSkillSnapshotMock.mock.calls[0][1].skillFilter).toBeUndefined();
|
expect(buildWorkspaceSkillSnapshotMock.mock.calls[0][1].skillFilter).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("passes empty skillFilter when agent explicitly disables all skills", async () => {
|
||||||
|
resolveAgentSkillsFilterMock.mockReturnValue([]);
|
||||||
|
|
||||||
|
const { runCronIsolatedAgentTurn } = await import("./run.js");
|
||||||
|
|
||||||
|
const result = await runCronIsolatedAgentTurn(
|
||||||
|
makeParams({
|
||||||
|
cfg: { agents: { list: [{ id: "silent", skills: [] }] } },
|
||||||
|
agentId: "silent",
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(result.status).toBe("ok");
|
||||||
|
expect(buildWorkspaceSkillSnapshotMock).toHaveBeenCalledOnce();
|
||||||
|
// Explicit empty skills list should forward [] to filter out all skills
|
||||||
|
expect(buildWorkspaceSkillSnapshotMock.mock.calls[0][1]).toHaveProperty("skillFilter", []);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user