@@ -14,6 +14,7 @@ let ReactDOM;
1414let ReactDOMServer ;
1515let ReactFeatureFlags ;
1616let Suspense ;
17+ let act ;
1718
1819describe ( 'ReactDOMServerPartialHydration' , ( ) => {
1920 beforeEach ( ( ) => {
@@ -24,6 +25,7 @@ describe('ReactDOMServerPartialHydration', () => {
2425
2526 React = require ( 'react' ) ;
2627 ReactDOM = require ( 'react-dom' ) ;
28+ act = require ( 'react-dom/test-utils' ) . act ;
2729 ReactDOMServer = require ( 'react-dom/server' ) ;
2830 Suspense = React . Suspense ;
2931 } ) ;
@@ -127,12 +129,15 @@ describe('ReactDOMServerPartialHydration', () => {
127129 // On the client we don't have all data yet but we want to start
128130 // hydrating anyway.
129131 suspend = true ;
130- ReactDOM . hydrate ( < App /> , container ) ;
132+
133+ act ( ( ) => {
134+ ReactDOM . hydrate ( < App /> , container ) ;
135+ } ) ;
131136
132137 expect ( container . firstChild . firstChild . tagName ) . not . toBe ( 'DIV' ) ;
133138
134139 // In this state, we can still update the siblings.
135- showSibling ( ) ;
140+ act ( ( ) => showSibling ( ) ) ;
136141
137142 expect ( container . firstChild . firstChild . tagName ) . toBe ( 'DIV' ) ;
138143 expect ( container . firstChild . firstChild . textContent ) . toBe ( 'First' ) ;
@@ -181,12 +186,14 @@ describe('ReactDOMServerPartialHydration', () => {
181186 // On the client we don't have all data yet but we want to start
182187 // hydrating anyway.
183188 suspend = true ;
184- ReactDOM . hydrate ( < App /> , container ) ;
189+ act ( ( ) => {
190+ ReactDOM . hydrate ( < App /> , container ) ;
191+ } ) ;
185192
186193 expect ( container . firstChild . children [ 1 ] . textContent ) . toBe ( 'Middle' ) ;
187194
188195 // In this state, we can still delete the boundary.
189- hideMiddle ( ) ;
196+ act ( ( ) => hideMiddle ( ) ) ;
190197
191198 expect ( container . firstChild . children [ 1 ] . textContent ) . toBe ( 'After' ) ;
192199 } ) ;
0 commit comments