Skip to content

Commit 40936ad

Browse files
committed
try this instead
1 parent 96f98e9 commit 40936ad

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

packages/react-scripts/fixtures/kitchensink/template/src/features/webpack/SvgComponent.test.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@
88
import * as React from 'react';
99
import SvgComponent, { SvgComponentWithRef } from './SvgComponent';
1010
import ReactDOMClient from 'react-dom/client';
11-
12-
global.IS_REACT_ACT_ENVIRONMENT = true;
11+
import { flushSync } from 'react-dom';
1312

1413
describe('svg component', () => {
15-
it('renders without crashing', () => {
14+
it('renders without crashing', async () => {
1615
const div = document.createElement('div');
17-
ReactDOMClient.createRoot(div).render(<SvgComponent />);
16+
flushSync(() => {
17+
ReactDOMClient.createRoot(div).render(<SvgComponent />);
18+
});
1819
expect(div.textContent).toBe('logo.svg');
1920
});
2021

2122
it('svg root element equals the passed ref', async () => {
2223
const div = document.createElement('div');
2324
const someRef = React.createRef();
24-
// eslint-disable-next-line testing-library/no-unnecessary-act
25-
await React.act(async () => {
25+
flushSync(() => {
2626
ReactDOMClient.createRoot(div).render(
2727
<SvgComponentWithRef ref={someRef} />
2828
);

0 commit comments

Comments
 (0)