mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-19 18:39:20 -05:00
chore: Fix failing test.
This commit is contained in:
@@ -9,6 +9,13 @@ const asRecord = (value: unknown): Record<string, unknown> => {
|
||||
return value as Record<string, unknown>;
|
||||
};
|
||||
|
||||
const getFirstToolParameters = (
|
||||
converted: ReturnType<typeof convertTools>,
|
||||
): Record<string, unknown> => {
|
||||
const functionDeclaration = asRecord(converted?.[0]?.functionDeclarations?.[0]);
|
||||
return asRecord(functionDeclaration.parametersJsonSchema ?? functionDeclaration.parameters);
|
||||
};
|
||||
|
||||
const makeModel = (id: string): Model<"google-generative-ai"> =>
|
||||
({
|
||||
id,
|
||||
@@ -53,7 +60,7 @@ describe("google-shared convertTools", () => {
|
||||
] as unknown as Tool[];
|
||||
|
||||
const converted = convertTools(tools);
|
||||
const params = asRecord(converted?.[0]?.functionDeclarations?.[0]?.parameters);
|
||||
const params = getFirstToolParameters(converted);
|
||||
|
||||
expect(params.type).toBeUndefined();
|
||||
expect(params.properties).toBeDefined();
|
||||
@@ -93,7 +100,7 @@ describe("google-shared convertTools", () => {
|
||||
] as unknown as Tool[];
|
||||
|
||||
const converted = convertTools(tools);
|
||||
const params = asRecord(converted?.[0]?.functionDeclarations?.[0]?.parameters);
|
||||
const params = getFirstToolParameters(converted);
|
||||
const properties = asRecord(params.properties);
|
||||
const mode = asRecord(properties.mode);
|
||||
const options = asRecord(properties.options);
|
||||
@@ -134,7 +141,7 @@ describe("google-shared convertTools", () => {
|
||||
] as unknown as Tool[];
|
||||
|
||||
const converted = convertTools(tools);
|
||||
const params = asRecord(converted?.[0]?.functionDeclarations?.[0]?.parameters);
|
||||
const params = getFirstToolParameters(converted);
|
||||
const config = asRecord(asRecord(params.properties).config);
|
||||
const configProps = asRecord(config.properties);
|
||||
const retries = asRecord(configProps.retries);
|
||||
|
||||
Reference in New Issue
Block a user