test(models): verify OpenAIClient baseURL wiring

This commit is contained in:
William Valentin
2026-02-15 10:54:05 -08:00
parent a624f5efb5
commit 0d73d180da
+28
View File
@@ -0,0 +1,28 @@
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');
});
});