mirror of
https://github.com/lobehub/lobe-chat.git
synced 2026-06-14 03:30:19 +00:00
fa6ef94067
* feat: 初步完成 * chore: type * feat: 图片功能 * feat: 文件下载功能 * refactor: 简化代码 * chore: 清理代码 * chore: clean * chore: 清理代码 * chore: 清理代码 * chore: 小改进 * fix: 上传完成前图片无法显示 * refactor: 增加 python-interpreter package * chore: 清理 * feat: 传入上下文中的文件 * chore: 小优化 * chore: 中文字体 * chore: clean * fix: 服务端部署 * fix: 重复文件检查 * test: 增加 interpreter.test.ts * test: add worker.test.ts * style: fix import * test: fix * style: fix import * style: move env file to envs * style: 限制代码框高度 * style: 重命名 * misc: 小修小补 * refactor: 重命名为 code-interpreter --------- Co-authored-by: Arvin Xu <arvinx@foxmail.com>
28 lines
765 B
TypeScript
28 lines
765 B
TypeScript
// @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();
|
|
});
|
|
});
|