React
Academy

Course outline

Unit testing React

Jest is a JavaScript testing library originally created at Facebook. It is deployed with Create-React-App. This makes it the most popular testing suite for React Apps.

Not only can Jest be used to test JavaScript, but it can be used with React to test the output of components.

Day 1

It's all about the tests
1. Introduction to Jest 
  • Testing strategies
  • Real DOM vs jsdom
  • Setting up jest
  • Running tests
  • Test options
  • Using the file watcher
  • Setting up the test environment in the code editor
2. Testing JavaScript 
  • Testing Javascript functions
  • Expect Matching
  • Asynchronous code
  • Setting up and tearing down tests
3. Testing React 
  • Testing approaches
  • Choosing a test runner
  • React Testing Libraries
  • React Setup/Teardown
  • act()
  • Rendering
  • Data Fetching
  • Mocking Modules
  • Firing Events
  • Mocking Timers
  • Snapshot Testing
  • Multiple Renderers
4. Other ways to test 
  • Shallow renderer
  • Test renderer
  • jsdom
  • Real DOM
5. Additional testing libraries 
  • React Testing Libraries
  • Enzyme from Airbnb
  • Mocha, testing in a browser
  • Ava, the light test runner
  • Bigger tests using Cypress, puppeteer or webdriver