Skip to content

Commit 1bfd60a

Browse files
committed
feat(PrismCode): react renderer * 8
1 parent d36eb96 commit 1bfd60a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/components/content/PrismCode/__tests__/PrismCode.test.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { render } from '@testing-library/react';
22
import React from 'react';
3+
import { act } from 'react-dom/test-utils';
34

45
import { PrismDiffCode } from '../../PrismDiffCode/PrismDiffCode';
56
import { 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();

0 commit comments

Comments
 (0)