Skip to content

Commit 4761a7a

Browse files
committed
f test
1 parent 447a85e commit 4761a7a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/__tests__/render.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ import ReactDOM from 'react-dom'
33
import ReactDOMServer from 'react-dom/server'
44
import {fireEvent, render, screen} from '../'
55

6+
afterEach(() => {
7+
if (console.error.mockRestore !== undefined) {
8+
console.error.mockRestore()
9+
}
10+
})
11+
612
test('renders div into document', () => {
713
const ref = React.createRef()
814
const {container} = render(<div ref={ref} />)
@@ -137,6 +143,7 @@ test('can be called multiple times on the same container', () => {
137143
})
138144

139145
test('hydrate will make the UI interactive', () => {
146+
jest.spyOn(console, 'error').mockImplementation(() => {})
140147
function App() {
141148
const [clicked, handleClick] = React.useReducer(n => n + 1, 0)
142149

@@ -154,6 +161,9 @@ test('hydrate will make the UI interactive', () => {
154161
expect(container).toHaveTextContent('clicked:0')
155162

156163
render(ui, {container, hydrate: true})
164+
165+
expect(console.error).not.toHaveBeenCalled()
166+
157167
fireEvent.click(container.querySelector('button'))
158168

159169
expect(container).toHaveTextContent('clicked:1')

0 commit comments

Comments
 (0)