Skip to content

Commit

Permalink
factor tests to assert different behavior between prod and dev
Browse files Browse the repository at this point in the history
  • Loading branch information
gnoff committed Apr 20, 2022
1 parent ebce981 commit 237e9d2
Showing 1 changed file with 15 additions and 11 deletions.
Expand Up @@ -866,17 +866,21 @@ describe('ReactDOMFizzServerHydrationWarning', () => {
);

expect(Scheduler).toFlushAndYield([]);
expect(mockError.mock.calls.length).toBe(1);
expect(mockError.mock.calls[0]).toEqual([
'Warning: Text content did not match. Server: "%s" Client: "%s"%s',
'initial',
'replaced',
'\n' +
' in h2 (at **)\n' +
' in Suspense (at **)\n' +
' in div (at **)\n' +
' in App (at **)',
]);
if (__DEV__) {
expect(mockError.mock.calls.length).toBe(1);
expect(mockError.mock.calls[0]).toEqual([
'Warning: Text content did not match. Server: "%s" Client: "%s"%s',
'initial',
'replaced',
'\n' +
' in h2 (at **)\n' +
' in Suspense (at **)\n' +
' in div (at **)\n' +
' in App (at **)',
]);
} else {
expect(mockError.mock.calls.length).toBe(0);
}
} finally {
console.error = originalConsoleError;
}
Expand Down

0 comments on commit 237e9d2

Please sign in to comment.