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.

28 lines (22 loc) 765 B
// @vitest-environment node import { beforeEach, describe, expect, it, vi } from 'vitest'; describe('Python interpreter', () => { beforeEach(() => { vi.resetModules(); }); it('should be undefined if is not in browser', async () => { const { PythonInterpreter } = await import('../index'); expect(PythonInterpreter).toBeUndefined(); }); it('should be defined if is in browser', async () => { const MockWorker = vi.fn().mockImplementation(() => ({ postMessage: vi.fn(), terminate: vi.fn(), addEventListener: vi.fn(), removeEventListener: vi.fn(), })); vi.stubGlobal('Worker', MockWorker); const { PythonInterpreter } = await import('../index'); expect(PythonInterpreter).toBeDefined(); }); });