My source code is:-
import React, { Component } from 'react';
class App extends Component {
constructor(props){
super(props);
this.state = {
count:1
}
}
handleClick = () => {
this.setState(prevState => {
return {count: prevState.count + 1}
})
}
render(){
return(
<button onClick ={this.handleClick.bind(this)}>{this.state.count}</button>
);
}
}
export default App;
But I getting following error:-
FAIL src/App.test.js
✓ check App Render (14ms)
✕ Test click event (17ms)
✓ Check count state 1 (2ms)
✓ Check count state 2 (2ms)
✓ Check count state 3 (2ms)
● Test click event
expect(jest.fn()).toHaveBeenCalledTimes(expected)
Expected number of calls: 100
Received number of calls: 0
21 | i++;
22 | }
> 23 | expect(spy).toHaveBeenCalledTimes(100);
| ^
24 | });
25 |
26 |
at Object.<anonymous> (src/App.test.js:23:15)
Test Suites: 1 failed, 1 total
Tests: 1 failed, 4 passed, 5 total
Snapshots: 0 total
Time: 1.98 s
Ran all test suites.
Please suggest me what is wrong here If anyone have any another source code please add here