AFFiNE/scripts/setup/vi-mock.ts
Saul-Mirone 35e232c61c
feat: migrate to blocksuite/affine (#8332)
Use `@blocksuite/affine` package for all blocksuite features in affine.

```ts
@blocksuite/store -> @blocksuite/affine/store
@blocksuite/global -> @blocksuite/affine/global
@blocksuite/block-std -> @blocksuite/affine/block-std
@blocksuite/blocks -> @blocksuite/affine/blocks
@blocksuite/presets -> @blocksuite/affine/presets
```
2024-09-20 10:55:47 +00:00

34 lines
669 B
TypeScript

import { vi } from 'vitest';
vi.mock('lottie-web', () => ({
default: {},
}));
vi.mock('@blocksuite/affine/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: {},
}));
if (typeof window !== 'undefined' && HTMLCanvasElement) {
// @ts-expect-error
HTMLCanvasElement.prototype.getContext = () => {
return {
fillRect: vi.fn(),
};
};
}