Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Justin Rich
Justin Rich
19,556 Points

Testing higher order components in React

Community, is there a good way to create unit/integration tests for higher order components. I'm writing apps that utilize wappers like Redux or Apollo JS (see http://dev.apollodata.com/). These libraries usually wrap around a component on export like so:

export default connect(mapStateToProps)(App);

or this

export default withApollo(ConvoListView)

and also this at the very top level (i.e. index.js)

<ApolloProvider client={client}>
<BrowserRouter>
  <Switch>
    <Route path='/' component={App} />
    <Route exact path="/" component={App}/>
  </Switch>
</BrowserRouter>

</ApolloProvider>

If you have any good articles/resources that describe common conventions for testing components that are wrapped with functions that provide some additionally functionality I'd greatly appreciate it.

Here's the project I'm working on as a frame of reference: https://github.com/justincrich/pug-chat