mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 21:48:27 +00:00
refactor: centralize message-provider tool filtering
This commit is contained in:
19
src/agents/pi-tools.message-provider-policy.test.ts
Normal file
19
src/agents/pi-tools.message-provider-policy.test.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { createOpenClawCodingTools } from "./pi-tools.js";
|
||||
|
||||
describe("createOpenClawCodingTools message provider policy", () => {
|
||||
it.each(["voice", "VOICE", " Voice "])(
|
||||
"does not expose tts tool for normalized voice provider: %s",
|
||||
(messageProvider) => {
|
||||
const tools = createOpenClawCodingTools({ messageProvider });
|
||||
const names = new Set(tools.map((tool) => tool.name));
|
||||
expect(names.has("tts")).toBe(false);
|
||||
},
|
||||
);
|
||||
|
||||
it("keeps tts tool for non-voice providers", () => {
|
||||
const tools = createOpenClawCodingTools({ messageProvider: "discord" });
|
||||
const names = new Set(tools.map((tool) => tool.name));
|
||||
expect(names.has("tts")).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user