AFFiNE/scripts/setup/vi-mock.ts

34 lines
669 B
TypeScript
Raw Normal View History

import { vi } from 'vitest';
vi.mock('lottie-web', () => ({
default: {},
}));
vi.mock('@blocksuite/affine/presets', () => ({
AffineEditorContainer: vi.fn(),
2024-03-09 18:01:16 +03:00
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(),
};
};
}