Skip to content

Commit cf946db

Browse files
committed
Add a test to verify no errors are printed in SSR usage
1 parent 8479774 commit cf946db

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/integration/server-rendering.spec.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,22 @@ describe('React', () => {
4040
expect(markup).toContain('Hello world')
4141
})
4242

43+
it('should run in an SSR environment without logging warnings about useLayoutEffect', () => {
44+
const store = createStore(greetingReducer)
45+
46+
const spy = jest.spyOn(console, 'error').mockImplementation(() => {})
47+
48+
const markup = renderToString(
49+
<Provider store={store}>
50+
<Greeter greeted="world" />
51+
</Provider>
52+
)
53+
54+
expect(spy).toHaveBeenCalledTimes(0)
55+
56+
spy.mockRestore()
57+
})
58+
4359
it('should render with updated state if actions are dispatched before render', () => {
4460
const store = createStore(greetingReducer)
4561

0 commit comments

Comments
 (0)