import { describe, expect, it, vi } from 'vitest';

let capturedOptions: any;

vi.mock('openai', () => {
  class OpenAI {
    constructor(options: any) {
      capturedOptions = options;
    }
  }
  return { default: OpenAI };
});

describe('OpenAIClient', () => {
  it('passes baseURL through to the OpenAI SDK', async () => {
    const { OpenAIClient } = await import('./openai.js');

    capturedOptions = undefined;
    new OpenAIClient({
      model: 'gpt-4.1',
      apiKey: 'sk-test',
      baseURL: 'https://example.com/v1',
    });

    expect(capturedOptions).toBeDefined();
    expect(capturedOptions.baseURL).toBe('https://example.com/v1');
  });
});
