Summary
Title: Effective Unit Testing - how to get value beyond line coverage metrics
Description:
When writing unit tests, it can be easy to focus on increasing the metrics around code-coverage, but are those tests bringing value, or just busy work to make a number go higher?
Using React and Jest, this talk will dive into unit testing and how to write tests that add value to your application, and not simply take time away from your day.
- Noise - things to not worry about rightnow
Rough Flow
- moved all of the test file to the tests folder so I could give them numbered file names to be easier to follow along with
- start with the
__tests__
/ vanilla
folder
- not testing implementation details
- avoid making everything 'public'
- example of helper function that may be useful to test vs not (
findProductName
vs arrayToMap
- partial object matching
- Going to use the Hacker News search data-fetching app as an example
- has API calls
- has a basic form
- can also show refactoring from Classes to Hooks - with keeping the tests passing
Speaker Notes / Code Snippets
Setting Up
Jest Intro