@lobehub/chat
Version:
Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.
22 lines (14 loc) • 578 B
text/typescript
import { Mock, describe, expect, it, vi } from 'vitest';
import { ModelsService } from '../models';
vi.stubGlobal('fetch', vi.fn());
// 创建一个测试用的 ModelsService 实例
const modelsService = new ModelsService();
describe('ModelsService', () => {
describe('getModels', () => {
it('should call the appropriate endpoint for a generic provider', async () => {
(fetch as Mock).mockResolvedValueOnce(new Response(JSON.stringify({ models: [] })));
await modelsService.getModels('openai');
expect(fetch).toHaveBeenCalled();
});
});
});