Skip to content

Commit

Permalink
Fix failing test related to client render fallbacks
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
gnoff committed Apr 19, 2022
1 parent 9c63094 commit aa164fa
Showing 1 changed file with 7 additions and 5 deletions.
Expand Up @@ -295,7 +295,7 @@ describe('ReactDOMServerPartialHydration', () => {
}
try {
const finalHTML = ReactDOMServer.renderToString(<App />);
const container = document.createElement('div');
const container = document.createElement('section');
container.innerHTML = finalHTML;
expect(Scheduler).toHaveYielded([
'Hello',
Expand Down Expand Up @@ -360,12 +360,14 @@ describe('ReactDOMServerPartialHydration', () => {
);

if (__DEV__) {
expect(mockError.mock.calls[0]).toEqual([
const secondToLastCall =
mockError.mock.calls[mockError.mock.calls.length - 2];
expect(secondToLastCall).toEqual([
'Warning: Expected server HTML to contain a matching <%s> in <%s>.%s',
'div',
'div',
'article',
'section',
'\n' +
' in div (at **)\n' +
' in article (at **)\n' +
' in Component (at **)\n' +
' in Suspense (at **)\n' +
' in App (at **)',
Expand Down

0 comments on commit aa164fa

Please sign in to comment.