test: mock react-syntax-highlighter to fix ESM compatibility in CodeBlock tests
This commit is contained in:
parent
5c2cc529ef
commit
0a37ca5aa7
1 changed files with 10 additions and 0 deletions
|
|
@ -2,6 +2,16 @@ import { render, screen, waitFor } from '@testing-library/react';
|
|||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
import { CodeBlock } from './CodeBlock';
|
||||
|
||||
// Mock react-syntax-highlighter to avoid ESM compatibility issues
|
||||
vi.mock('react-syntax-highlighter', () => ({
|
||||
Prism: ({ children, ...props }: any) => <code {...props}>{children}</code>,
|
||||
}));
|
||||
|
||||
vi.mock('react-syntax-highlighter/dist/esm/styles/prism', () => ({
|
||||
prism: {},
|
||||
vscDarkPlus: {},
|
||||
}));
|
||||
|
||||
// Mock clipboard API
|
||||
const mockClipboard = {
|
||||
writeText: vi.fn(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue