File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
src/components/content/PrismCode/__tests__ Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 11import { render } from '@testing-library/react' ;
22import React from 'react' ;
3+ import { act } from 'react-dom/test-utils' ;
34
45import { PrismDiffCode } from '../../PrismDiffCode/PrismDiffCode' ;
56import { PrismCode } from '../PrismCode' ;
@@ -18,7 +19,9 @@ describe('PrismCode component', () => {
1819 ) ;
1920
2021 // Wait for async highlight component to load
21- await new Promise ( ( resolve ) => setTimeout ( resolve , 100 ) ) ;
22+ await act ( async ( ) => {
23+ await new Promise ( ( resolve ) => setTimeout ( resolve , 100 ) ) ;
24+ } ) ;
2225
2326 const codeElement = container . querySelector ( 'code' ) ;
2427 expect ( codeElement ) . toBeInTheDocument ( ) ;
@@ -48,7 +51,9 @@ describe('PrismCode component', () => {
4851 ) ;
4952
5053 // Wait for async highlight component to load
51- await new Promise ( ( resolve ) => setTimeout ( resolve , 100 ) ) ;
54+ await act ( async ( ) => {
55+ await new Promise ( ( resolve ) => setTimeout ( resolve , 100 ) ) ;
56+ } ) ;
5257
5358 const codeElement = container . querySelector ( 'code' ) ;
5459 expect ( codeElement ) . toBeInTheDocument ( ) ;
You can’t perform that action at this time.
0 commit comments