The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

React Testing: Utility modules

React Testing: Utility modules

2:19
When writing tests for our React code, it is helpful to pull out any functionality that doesn't have to do with our UI components into separate modules, so that they can be tested separately. In this lesson, we will take a look at a React component and how we can pull out some of its generic utility logic into a separate module. We will then write some tests for that module.
Watch this lesson now
Avatar
egghead.io

When writing tests for our React code, it is helpful to pull out any functionality that doesn't have to do with our UI components into separate modules, so that they can be tested separately. In this lesson, we will take a look at a React component and how we can pull out some of its generic utility logic into a separate module. We will then write some tests for that module.

Avatar
Martin Bayly

It would be useful if the sample code for this video series was broken down into separate branches or tags in the git repo to match each lesson to make it easier to follow along by coding and then refreshing to get the sample solution.

Avatar
Joe

I totally agree. It would make following along with the lesson so much easier.

In reply to Martin Bayly
Avatar
Trevor

Thanks for the feedback Martin and Joe

In reply to Joe
Avatar
Adam Cardenas

yeah, kinda sucks that we cannot follow along

In reply to Joe
Avatar
Simon

I've done a bunch of Egghead lessons about react and redux in the previous weeks and they were really nice.
This one is weird : git repo is not tagged for each lesson, so I just clone master, run npm install (twice because it fails on the first time because... npm I guess).
I run npm run test it fails for some tests because of some TypeError... ok...
I run npm run dev or run serve it fails because of some react-color-picket asset... ok...

Anyway I start the video, not even 1 minute to say what we are dealing with. So good luck for me to understand what could be the react-color-picker error above, or the TypeError.
Of course files I got from master branch are not the one displayed in the video. In fact, I guess only reading the code without watching video would do the same trick. Or just go to read documentation about expect, mocha and friends.

It kind of sucks because it seems there are lot of things to be learnt from your lessons, but the way it was built really does not help.

In reply to egghead.io
HEY, QUICK QUESTION!
Joel's Head
Why are we asking?