I want to write a test suite when isPending: true
render(){
const {onSearchChange, isPending } = this.props;
if(isPending){
return(<h1>Loading</h1>
)
}else{
return (
<div className="App">
<Scroll>
<ErrorBoundry>
<CardList robots={this.filteredRobots()}/>
</ErrorBoundry>
</Scroll>
</div>
)
}
}
below is test suite that i have written
it('return none when pending is true', () => {
const mockProps3 = {
getRobots: jest.fn(),
robots: [],
searchField: '',
isPending: true
}
const wrapper3 = shallow(<MainPage {...mockProps3} />);
//expect(wrapper3.equals(<h1>Loading</h1>)).to.equal(true);
expect(wrapper3.html()).to.equal('<h1>Loading</h1>');
})
But getting the below error in both cases
TypeError: Cannot read property 'equal' of undefined