pengx17
2024-05-31 10:28:37 +00:00
parent b65c01c5e1
commit ea0059fa1b
31 changed files with 1018 additions and 44 deletions

37
scripts/setup/vi-mock.ts Normal file
View File

@@ -0,0 +1,37 @@
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(),
AIProvider: {
slots: new Proxy(
{},
{
get: () => ({
on: vi.fn(),
}),
}
),
provide: vi.fn(),
},
AIEdgelessRootBlockSpec: {},
AIParagraphBlockSpec: {},
AIPageRootBlockSpec: {},
}));
if (typeof window !== 'undefined' && HTMLCanvasElement) {
// @ts-expect-error
HTMLCanvasElement.prototype.getContext = () => {
return {
fillRect: vi.fn(),
};
};
}