mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 15:04:33 +00:00
test: migrate suites to e2e coverage layout
This commit is contained in:
29
src/agents/tool-policy.e2e.test.ts
Normal file
29
src/agents/tool-policy.e2e.test.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { expandToolGroups, resolveToolProfilePolicy, TOOL_GROUPS } from "./tool-policy.js";
|
||||
|
||||
describe("tool-policy", () => {
|
||||
it("expands groups and normalizes aliases", () => {
|
||||
const expanded = expandToolGroups(["group:runtime", "BASH", "apply-patch", "group:fs"]);
|
||||
const set = new Set(expanded);
|
||||
expect(set.has("exec")).toBe(true);
|
||||
expect(set.has("process")).toBe(true);
|
||||
expect(set.has("bash")).toBe(false);
|
||||
expect(set.has("apply_patch")).toBe(true);
|
||||
expect(set.has("read")).toBe(true);
|
||||
expect(set.has("write")).toBe(true);
|
||||
expect(set.has("edit")).toBe(true);
|
||||
});
|
||||
|
||||
it("resolves known profiles and ignores unknown ones", () => {
|
||||
const coding = resolveToolProfilePolicy("coding");
|
||||
expect(coding?.allow).toContain("group:fs");
|
||||
expect(resolveToolProfilePolicy("nope")).toBeUndefined();
|
||||
});
|
||||
|
||||
it("includes core tool groups in group:openclaw", () => {
|
||||
const group = TOOL_GROUPS["group:openclaw"];
|
||||
expect(group).toContain("browser");
|
||||
expect(group).toContain("message");
|
||||
expect(group).toContain("session_status");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user