Skip to content

Commit

Permalink
simplify console error expects
Browse files Browse the repository at this point in the history
  • Loading branch information
salazarm committed Jan 27, 2022
1 parent 2e2efb6 commit 2d3e29e
Showing 1 changed file with 4 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ describe('ReactDOMServerPartialHydration', () => {
if (shouldSuspend) {
throw promise;
}
return <div />;
return <></>;
}

const finalHTML = ReactDOMServer.renderToString(<App hasB={true} />);
Expand Down Expand Up @@ -542,20 +542,14 @@ describe('ReactDOMServerPartialHydration', () => {
}

if (__DEV__) {
if (gate(flags => flags.enableClientRenderFallbackOnHydrationMismatch)) {
expect(console.error.calls.count()).toBe(2);
const errorArgs = console.error.calls.all().shift().args;
expect(errorArgs[0]).toContain(
'An error occurred during hydration. The server HTML was replaced with client content',
);
} else {
expect(console.error.calls.count()).toBe(1);
}
expect(console.error.calls.count()).toBe(1);

const errorArgs = console.error.calls.all().pop().args;
expect(errorArgs[0]).toBe(
'Warning: Did not expect server HTML to contain a <%s> in <%s>.%s',
);
expect(errorArgs[1]).toBe('span');
expect(errorArgs[2]).toBe('div');
}
});

Expand Down

0 comments on commit 2d3e29e

Please sign in to comment.