Skip to content

Commit

Permalink
Make test better
Browse files Browse the repository at this point in the history
it not has an intentional client mismatch that would error if there wasn't supression brought about by the earlier error. when it client rendres it has the updated value not found in the server response but we do not see a hydration warning because it was superseded by the thrown error in that render
  • Loading branch information
gnoff committed Apr 20, 2022
1 parent 3fd1eb6 commit be1cefa
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js
Expand Up @@ -3037,9 +3037,9 @@ describe('ReactDOMFizzServer', () => {
<ThrowUntilOnClient>
<h1>one</h1>
</ThrowUntilOnClient>
<StopThrowingOnClient />
<h2>two</h2>
<h3>three</h3>
<h3>{isClient ? 'five' : 'three'}</h3>
<StopThrowingOnClient />
</Suspense>
</div>
);
Expand Down Expand Up @@ -3067,20 +3067,18 @@ describe('ReactDOMFizzServer', () => {
);
},
});
await act(async () => {
expect(Scheduler).toFlushAndYieldThrough([
'Logged recoverable error: uh oh',
'Logged recoverable error: Hydration failed because the initial UI does not match what was rendered on the server.',
'Logged recoverable error: Hydration failed because the initial UI does not match what was rendered on the server.',
'Logged recoverable error: There was an error while hydrating this Suspense boundary. Switched to client rendering.',
]);
});
expect(Scheduler).toFlushAndYield([
'Logged recoverable error: uh oh',
'Logged recoverable error: Hydration failed because the initial UI does not match what was rendered on the server.',
'Logged recoverable error: Hydration failed because the initial UI does not match what was rendered on the server.',
'Logged recoverable error: There was an error while hydrating this Suspense boundary. Switched to client rendering.',
]);

expect(getVisibleChildren(container)).toEqual(
<div>
<h1>one</h1>
<h2>two</h2>
<h3>three</h3>
<h3>five</h3>
</div>,
);

Expand Down

0 comments on commit be1cefa

Please sign in to comment.