Skip to content

Commit cc0158c

Browse files
committed
Fix failing test related to client render fallbacks
This test was actually subject to the project identified in the issue fixed in this branch. After fixing the underlying issue the assertion logic needed to change to pick the right warning which now emits after hydration successfully completes on promise resolution. I changed the container type to 'section' to make the error message slightly easier to read/understand (for me)
1 parent 99da28b commit cc0158c

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ describe('ReactDOMServerPartialHydration', () => {
295295
}
296296
try {
297297
const finalHTML = ReactDOMServer.renderToString(<App />);
298-
const container = document.createElement('div');
298+
const container = document.createElement('section');
299299
container.innerHTML = finalHTML;
300300
expect(Scheduler).toHaveYielded([
301301
'Hello',
@@ -360,12 +360,14 @@ describe('ReactDOMServerPartialHydration', () => {
360360
);
361361

362362
if (__DEV__) {
363-
expect(mockError.mock.calls[0]).toEqual([
363+
const secondToLastCall =
364+
mockError.mock.calls[mockError.mock.calls.length - 2];
365+
expect(secondToLastCall).toEqual([
364366
'Warning: Expected server HTML to contain a matching <%s> in <%s>.%s',
365-
'div',
366-
'div',
367+
'article',
368+
'section',
367369
'\n' +
368-
' in div (at **)\n' +
370+
' in article (at **)\n' +
369371
' in Component (at **)\n' +
370372
' in Suspense (at **)\n' +
371373
' in App (at **)',

0 commit comments

Comments
 (0)