File tree 1 file changed +10
-0
lines changed
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,12 @@ import ReactDOM from 'react-dom'
3
3
import ReactDOMServer from 'react-dom/server'
4
4
import { fireEvent , render , screen } from '../'
5
5
6
+ afterEach ( ( ) => {
7
+ if ( console . error . mockRestore !== undefined ) {
8
+ console . error . mockRestore ( )
9
+ }
10
+ } )
11
+
6
12
test ( 'renders div into document' , ( ) => {
7
13
const ref = React . createRef ( )
8
14
const { container} = render ( < div ref = { ref } /> )
@@ -137,6 +143,7 @@ test('can be called multiple times on the same container', () => {
137
143
} )
138
144
139
145
test ( 'hydrate will make the UI interactive' , ( ) => {
146
+ jest . spyOn ( console , 'error' ) . mockImplementation ( ( ) => { } )
140
147
function App ( ) {
141
148
const [ clicked , handleClick ] = React . useReducer ( n => n + 1 , 0 )
142
149
@@ -154,6 +161,9 @@ test('hydrate will make the UI interactive', () => {
154
161
expect ( container ) . toHaveTextContent ( 'clicked:0' )
155
162
156
163
render ( ui , { container, hydrate : true } )
164
+
165
+ expect ( console . error ) . not . toHaveBeenCalled ( )
166
+
157
167
fireEvent . click ( container . querySelector ( 'button' ) )
158
168
159
169
expect ( container ) . toHaveTextContent ( 'clicked:1' )
You can’t perform that action at this time.
0 commit comments