fix test lints

This commit is contained in:
uinstinct 2026-01-06 17:58:48 +05:30
parent c219e3e5c9
commit 5f7ecaba01
2 changed files with 13 additions and 8 deletions

View file

@ -10,21 +10,24 @@ describe("Tool Definitions", () => {
isSignedIn: false,
isRemote: false,
modelName: "a model",
ide: {} as any,
};
// Helper function to get the actual tool object
const getToolObject = (toolDefinition: Tool | GetTool): Tool => {
const getToolObject = async (
toolDefinition: Tool | GetTool,
): Promise<Tool> => {
if (typeof toolDefinition === "function") {
return toolDefinition(mockParams);
}
return toolDefinition;
};
it("should have all required parameters defined in properties for each tool", () => {
it("should have all required parameters defined in properties for each tool", async () => {
const exportedTools = Object.values(toolDefinitions);
exportedTools.forEach((toolDefinition) => {
const tool = getToolObject(toolDefinition);
for (const toolDefinition of exportedTools) {
const tool = await getToolObject(toolDefinition);
// Each tool should have the required structure
expect(tool).toHaveProperty("type", "function");
@ -52,6 +55,6 @@ describe("Tool Definitions", () => {
expect(typeof property.type).toBe("string");
});
}
});
}
});
});

View file

@ -2,14 +2,15 @@ import { expect, test } from "vitest";
import { BuiltInToolNames } from "./builtIn";
import { getConfigDependentToolDefinitions } from "./index";
test("searchWeb tool is only available when user is signed in", () => {
test("searchWeb tool is only available when user is signed in", async () => {
// Test with signed-in user
const signedInTools = getConfigDependentToolDefinitions({
const signedInTools = await getConfigDependentToolDefinitions({
rules: [],
enableExperimentalTools: false,
isSignedIn: true,
isRemote: false,
modelName: "",
ide: {} as any,
});
const searchWebToolSignedIn = signedInTools.find(
@ -19,12 +20,13 @@ test("searchWeb tool is only available when user is signed in", () => {
expect(searchWebToolSignedIn?.displayTitle).toBe("Search Web");
// Test with non-signed-in user
const notSignedInTools = getConfigDependentToolDefinitions({
const notSignedInTools = await getConfigDependentToolDefinitions({
rules: [],
enableExperimentalTools: false,
isSignedIn: false,
isRemote: false,
modelName: "",
ide: {} as any,
});
const searchWebToolNotSignedIn = notSignedInTools.find(