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