UNPKG

@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.

30 lines (24 loc) 926 B
// @vitest-environment edge-runtime import { describe, expect, it, vi } from 'vitest'; import { POST as UniverseRoute } from '../[provider]/route'; import { POST, preferredRegion, runtime } from './route'; vi.mock('../[provider]/route', () => ({ POST: vi.fn().mockResolvedValue('mocked response'), })); describe('Configuration tests', () => { it('should have runtime set to "edge"', () => { expect(runtime).toBe('edge'); }); it('should contain specific regions in preferredRegion', () => { expect(preferredRegion).not.contain(['hk1']); }); }); describe('Groq POST function tests', () => { it('should call UniverseRoute with correct parameters', async () => { const mockRequest = new Request('https://example.com', { method: 'POST' }); await POST(mockRequest); expect(UniverseRoute).toHaveBeenCalledWith(mockRequest, { params: Promise.resolve({ provider: 'groq' }), }); }); });