File tree Expand file tree Collapse file tree 5 files changed +107
-114
lines changed
Expand file tree Collapse file tree 5 files changed +107
-114
lines changed Original file line number Diff line number Diff line change @@ -24,3 +24,14 @@ const localStorageMock = {
2424} ;
2525global . localStorage = localStorageMock as any ;
2626
27+ // Mock IntersectionObserver to prevent async state updates in tests
28+ global . IntersectionObserver = class IntersectionObserver {
29+ constructor ( ) { }
30+ disconnect ( ) { }
31+ observe ( ) { }
32+ takeRecords ( ) {
33+ return [ ] ;
34+ }
35+ unobserve ( ) { }
36+ } as unknown as typeof IntersectionObserver ;
37+
Original file line number Diff line number Diff line change 11'use client' ;
22
33import { Prism as SyntaxHighlighter } from 'react-syntax-highlighter' ;
4- import { vscDarkPlus } from 'react-syntax-highlighter/dist/esm /styles/prism' ;
4+ import { vscDarkPlus } from 'react-syntax-highlighter/dist/cjs /styles/prism' ;
55
66interface CodeBlockProps {
77 code : string ;
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ const customJestConfig = {
1111 testEnvironment : 'jest-environment-jsdom' ,
1212 moduleNameMapper : {
1313 '^@/(.*)$' : '<rootDir>/$1' ,
14+ '^react-syntax-highlighter/dist/esm/(.*)$' : 'react-syntax-highlighter/dist/cjs/$1' ,
1415 } ,
1516 testMatch : [ '**/__tests__/**/*.test.[jt]s?(x)' ] ,
1617 collectCoverageFrom : [
You can’t perform that action at this time.
0 commit comments