the react.js displays error from server side when i tried to write unittest its failed
react.js
async function(){
try{
//some logic happens
}
catch(error){
//catches error from server side
this.setState({errorMessage: err.message});
}
return(
//displays the error
{ this.state.errorMessage &&
<h3 className="error"> { this.state.errorMessage } </h3> }
)
The Test which i tried
unittest.js
it("should display error", ()=>{
expect(()=>render(<function/>).tothrow("error Message"))
};