Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

How to test the usage of High Order Components

Instead of using hocs directly or composing them with compose/flowRight, we use the createEnhancer helper.

The createEnhancer helper accepts a list describing the hocs that will be applied, this way the hocs are not called on the spot and we can use that list on the test environment to make sure that they are the right ones, on the right order and with the right arguments.

This is how the hocs are used with createEnhancer:

const app = props => (...)

export const enhancer = createEnhancer(
  [graphql, "SOME QUERY", "SOME OPTIONS"],
  [withLoading, props =>],
  [withProps, props => ({ movies: })]

export default enhancer(app)

and this is how we can test the enhancer

test("enhancer loads movies from graphql", () => {

How to run

yarn // install dependencies
yarn start // run the dev environment
yarn test // run tests
You can’t perform that action at this time.