We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 489496c commit ba21513Copy full SHA for ba21513
src/server/__tests__/ssr.test.ts
@@ -0,0 +1,22 @@
1
+/**
2
+ * @jest-environment node
3
+ */
4
+ import {useState} from 'react'
5
+ import {renderHook, act} from '..'
6
+
7
+ // This verifies that renderHook can be called in
8
+ // a SSR-like environment.
9
+ describe('renderHook', () => {
10
+ function useLoading() {
11
+ if (typeof window !== 'undefined') {
12
+ const [loading, setLoading] = useState(false)
13
+ return {loading, setLoading}
14
+ }
15
16
17
+ test('should not throw in SSR environment', () => {
18
+ expect(() => renderHook(() => useLoading())).not.toThrowError(
19
+ 'document is not defined',
20
+ )
21
+ })
22
0 commit comments