UNPKG

@wavequery/conductor

Version:
45 lines 1.46 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const chain_1 = require("../chain"); describe("Chain", () => { let mockTool; let mockLLM; let chain; beforeEach(() => { mockTool = { name: "test-tool", description: "Test tool", execute: jest.fn(), }; mockLLM = { complete: jest.fn(), completeWithFunctions: jest.fn(), }; const config = { name: "test-chain", llmProvider: mockLLM, tools: [mockTool], steps: [ { name: "step1", tool: "test-tool", input: { test: true }, }, { name: "step2", prompt: "Process {input}", }, ], }; chain = new chain_1.Chain(config); }); it("should execute chain steps in order", async () => { mockTool.execute.mockResolvedValueOnce({ result: "step1" }); mockLLM.complete.mockResolvedValueOnce({ content: "step2 result" }); const result = await chain.execute({ initial: "input" }); expect(result.steps).toHaveLength(2); expect(result.steps[0].output).toEqual({ result: "step1" }); expect(result.steps[1].output.content).toEqual("step2 result"); }); }); //# sourceMappingURL=chain.test.js.map