mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-15 17:42:48 +03:00
54 lines
1.0 KiB
TypeScript
54 lines
1.0 KiB
TypeScript
import { vi } from 'vitest';
|
|
|
|
vi.mock('lottie-web', () => ({
|
|
default: {},
|
|
}));
|
|
|
|
vi.mock('@blocksuite/presets', () => ({
|
|
AffineEditorContainer: vi.fn(),
|
|
BiDirectionalLinkPanel: vi.fn(),
|
|
DocMetaTags: vi.fn(),
|
|
DocTitle: vi.fn(),
|
|
EdgelessEditor: vi.fn(),
|
|
PageEditor: vi.fn(),
|
|
AIChatBlockSchema: {
|
|
version: 1,
|
|
model: {
|
|
version: 1,
|
|
flavour: 'affine:embed-ai-chat',
|
|
role: 'content',
|
|
children: [],
|
|
},
|
|
},
|
|
AIChatBlockSpec: {},
|
|
EdgelessAIChatBlockSpec: {},
|
|
}));
|
|
|
|
vi.mock('@blocksuite/presets/ai', () => ({
|
|
AIProvider: {
|
|
slots: new Proxy(
|
|
{},
|
|
{
|
|
get: () => ({
|
|
on: vi.fn(),
|
|
}),
|
|
}
|
|
),
|
|
provide: vi.fn(),
|
|
},
|
|
AIEdgelessRootBlockSpec: {},
|
|
AICodeBlockSpec: {},
|
|
AIImageBlockSpec: {},
|
|
AIParagraphBlockSpec: {},
|
|
AIPageRootBlockSpec: {},
|
|
}));
|
|
|
|
if (typeof window !== 'undefined' && HTMLCanvasElement) {
|
|
// @ts-expect-error
|
|
HTMLCanvasElement.prototype.getContext = () => {
|
|
return {
|
|
fillRect: vi.fn(),
|
|
};
|
|
};
|
|
}
|