UNPKG

@wavequery/conductor

Version:
50 lines 1.58 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const base_tool_1 = require("../base-tool"); const tool_type_1 = require("@/types/enums/tool-type"); class TestTool extends base_tool_1.BaseTool { async execute(input) { return { success: true, data: input, }; } } describe("BaseTool", () => { const validConfig = { name: "test-tool", type: tool_type_1.ToolType.ANALYSIS, version: "1.0.0", description: "Test tool", executionMode: tool_type_1.ToolExecutionMode.SYNC, input: { schema: {}, required: [], }, output: { schema: {}, }, }; it("should create tool with valid config", () => { const tool = new TestTool(validConfig); expect(tool.name).toBe("test-tool"); expect(tool.description).toBe("Test tool"); }); it("should throw error for invalid config", () => { const invalidConfig = { ...validConfig, version: "invalid" }; expect(() => new TestTool(invalidConfig)).toThrow(); }); it("should handle retries", async () => { const tool = new TestTool(validConfig); let attempts = 0; const result = await tool["executeWithRetry"](async () => { attempts++; if (attempts < 2) throw new Error("Retry test"); return "success"; }); expect(attempts).toBe(2); expect(result).toBe("success"); }); }); //# sourceMappingURL=base-tool.test.js.map