| 1 | import type { AssistantUnrolled } from "@continuedev/config-yaml"; |
| 2 | import { vi } from "vitest"; |
| 3 | |
| 4 | import { MockApiClient } from "./mocks/MockApiClient.js"; |
| 5 | import { MockLlmApi } from "./mocks/MockLlmApi.js"; |
| 6 | import { MockMCPService } from "./mocks/MockMCPService.js"; |
| 7 | |
| 8 | // Re-export the mocks for backward compatibility |
| 9 | export { MockApiClient, MockLlmApi, MockMCPService }; |
| 10 | |
| 11 | // Mock Assistant config |
| 12 | export const mockAssistant: AssistantUnrolled = { |
| 13 | name: "test-assistant", |
| 14 | models: [ |
| 15 | { |
| 16 | provider: "openai", |
| 17 | name: "test-model", |
| 18 | model: "test-model", |
| 19 | }, |
| 20 | ], |
| 21 | systemMessage: "You are a helpful assistant", |
| 22 | tools: [], |
| 23 | mcpServers: [], |
| 24 | } as any; |
| 25 | |
| 26 | // Mock glob function with files that actually exist in the repository |
| 27 | vi.mock("glob", () => ({ |
| 28 | glob: vi |
| 29 | .fn<any>() |
| 30 | .mockResolvedValue([ |
| 31 | ".env.example", |
| 32 | ".gitignore", |
| 33 | "AGENTS.md", |
| 34 | "CHANGELOG.md", |
| 35 | "README.md", |
| 36 | "package.json", |
| 37 | "src/index.ts", |
| 38 | "src/types.ts", |
| 39 | "LICENSE", |
| 40 | "test-file.txt", |
| 41 | ]), |
| 42 | })); |
| 43 | |
| 44 | export const createProps = (overrides: any = {}) => ({ |
| 45 | config: mockAssistant, |
| 46 | model: "test-model", |
| 47 | llmApi: new MockLlmApi(), |
| 48 | mcpService: new MockMCPService(), |
| 49 | apiClient: new MockApiClient(), |
| 50 | configPath: undefined, |
| 51 | initialPrompt: undefined, |
| 52 | resume: false, |
| 53 | additionalRules: [], |
| 54 | ...overrides, |
| 55 | }); |
| 56 | |
| 57 | // Add a dummy test to satisfy Vitest requirement |
| 58 | describe("TUIChat setup", () => { |
| 59 | test("setup should export required functions", () => { |
| 60 | expect(createProps).toBeDefined(); |
| 61 | expect(mockAssistant).toBeDefined(); |
| 62 | }); |
| 63 | }); |