| 1 | import fs from "fs/promises"; |
| 2 | import path from "path"; |
| 3 | |
| 4 | import { |
| 5 | cleanupTestContext, |
| 6 | createTestContext, |
| 7 | runCLI, |
| 8 | } from "../test-helpers/cli-helpers.js"; |
| 9 | |
| 10 | describe("E2E: Headless Mode (Minimal)", () => { |
| 11 | let context: any; |
| 12 | |
| 13 | beforeEach(async () => { |
| 14 | context = await createTestContext(); |
| 15 | }); |
| 16 | |
| 17 | afterEach(async () => { |
| 18 | await cleanupTestContext(context); |
| 19 | }); |
| 20 | |
| 21 | it("should accept a config file path", async () => { |
| 22 | // Create a minimal YAML config |
| 23 | const configPath = path.join(context.testDir, "test-config.yaml"); |
| 24 | await fs.writeFile( |
| 25 | configPath, |
| 26 | `name: Test Assistant |
| 27 | model: gpt-4 |
| 28 | provider: openai`, |
| 29 | ); |
| 30 | |
| 31 | // For now, just test that it tries to load the config |
| 32 | // Without proper mocking, it will fail to connect to OpenAI |
| 33 | const result = await runCLI(context, { |
| 34 | args: ["-p", "--config", configPath, "Hello"], |
| 35 | env: { OPENAI_API_KEY: "test-key" }, |
| 36 | expectError: true, |
| 37 | }); |
| 38 | |
| 39 | // The fact that it gets past config loading is what we're testing |
| 40 | expect(result.exitCode).toBeDefined(); |
| 41 | }); |
| 42 | }); |