refactor(google-tests): share schema tool fixture

This commit is contained in:
Peter Steinberger 2026-03-17 07:33:42 +00:00
parent ef0812beff
commit 58f6362921

View File

@ -11,6 +11,18 @@ describe("sanitizeToolsForGoogle", () => {
execute: async () => ({ ok: true, content: [] }),
}) as unknown as AgentTool;
const createSchemaToolWithFormat = () =>
createTool({
type: "object",
additionalProperties: false,
properties: {
foo: {
type: "string",
format: "uuid",
},
},
});
const expectFormatRemoved = (
sanitized: AgentTool,
key: "additionalProperties" | "patternProperties",
@ -25,16 +37,7 @@ describe("sanitizeToolsForGoogle", () => {
};
it("strips unsupported schema keywords for Google providers", () => {
const tool = createTool({
type: "object",
additionalProperties: false,
properties: {
foo: {
type: "string",
format: "uuid",
},
},
});
const tool = createSchemaToolWithFormat();
const [sanitized] = sanitizeToolsForGoogle({
tools: [tool],
provider: "google-gemini-cli",
@ -43,16 +46,7 @@ describe("sanitizeToolsForGoogle", () => {
});
it("returns original tools for non-google providers", () => {
const tool = createTool({
type: "object",
additionalProperties: false,
properties: {
foo: {
type: "string",
format: "uuid",
},
},
});
const tool = createSchemaToolWithFormat();
const sanitized = sanitizeToolsForGoogle({
tools: [tool],
provider: "openai",