I want to shallow render a component and check to see if it doesn't crash. The docs tells me that shallow rendering doesn't go any deeper into child components.
I have this code:
it("Renders the Compare landing page without crashing", () => {
shallow(<Compare />);
});
The Compare Component contains the following code:
<Fragment>
<Sidenav params={this.props.match.params.gamerId} />
<div className="content-area">
<SearchBar
updateSearch={this.updateSearch}
placeholder={"Filter by Friends"}
/>
<div className="friends">
{filteredFriends.map((friend, key) => {
return (
<Friend
name={friend}
key={key}
index={key}
goToCompare={this.goToCompare}
/>
);
})}
</div>
</div>
</Fragment>
The test throws the following error:

Shouldn't the test just ignore the <SideNav />, what am I missing here?
Aucun commentaire:
Enregistrer un commentaire