Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(PrismCode): react renderer * 8
  • Loading branch information
tenphi committed Jun 3, 2025
commit 1bfd60a85c68248af61749fce5af2cda8c4d6a1f
9 changes: 7 additions & 2 deletions src/components/content/PrismCode/__tests__/PrismCode.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { render } from '@testing-library/react';
import React from 'react';
import { act } from 'react-dom/test-utils';

import { PrismDiffCode } from '../../PrismDiffCode/PrismDiffCode';
import { PrismCode } from '../PrismCode';
Expand All @@ -18,7 +19,9 @@ describe('PrismCode component', () => {
);

// Wait for async highlight component to load
await new Promise((resolve) => setTimeout(resolve, 100));
await act(async () => {
await new Promise((resolve) => setTimeout(resolve, 100));
});

const codeElement = container.querySelector('code');
expect(codeElement).toBeInTheDocument();
Expand Down Expand Up @@ -48,7 +51,9 @@ describe('PrismCode component', () => {
);

// Wait for async highlight component to load
await new Promise((resolve) => setTimeout(resolve, 100));
await act(async () => {
await new Promise((resolve) => setTimeout(resolve, 100));
});

const codeElement = container.querySelector('code');
expect(codeElement).toBeInTheDocument();
Expand Down
Loading