Rangle.io: React Training
gitbook
gitbook
  • Introduction
  • Setup
  • Functional JavaScript
  • ES6 constructs
    • Default Params
    • Template Literals
    • Destructuring
    • Arrow Functions
    • Promises
    • let and const
    • Modules
  • Thinking in Components
    • Atomic Design
    • Atomic Component Principles
    • Benefits of This Approach
    • The Process
    • Task #1
  • React Components
    • Stateless Components
    • Stateful Components
    • Stateful vs Stateless Components
    • Composition
    • Task #2
    • Task #3
    • Task #4
    • Task #5
  • Immutable
    • What Is Immutability?
    • The Case for Immutability
    • JavaScript Solutions
      • Object.assign
      • Object.freeze
    • Immutable.js Basics
      • Immutable.Map
        • Map.merge
      • Nested Objects
        • Deleting Keys
        • Maps are Iterable
      • Immutable.List
      • Performance
      • Persistent and Transient Data Structures
      • Official Documentation
    • Exercises
      • Task #1
      • Task #2
      • Task #3
      • Task #4
      • Task #5
      • Task #6
      • Task #7
  • Redux
    • Review of Reducers and Pure Functions
    • Redux Reducers
    • Redux Actions
    • Configuring your Application to use Redux
    • Using Redux with Components
    • Redux and Component Architecture
  • Routing
    • React Router
    • Router Redux
  • Forms
    • Redux Form
  • Testing
    • Setup
    • Components
    • Reducers
    • Actions
Powered by GitBook
On this page
  • Setup
  • Enzyme
  • JSDOM

Was this helpful?

  1. Testing

Setup

Setup

To get started, we need to do a little bit of setup. Install the following dependencies.

  • babel-eslint

  • babel-preset-es2015

  • babel-preset-react

  • babel-preset-stage-0

  • babel-register

  • chai

  • enzyme

  • jsdom

  • mock-localstorage

  • react-addons-test-utils

  • redux-mock-store

  • sinon

  • mocha

  • nock

Enzyme

JSDOM

PreviousTestingNextComponents

Last updated 6 years ago

Was this helpful?

allows for rendering of React Components in three different ways: render (static component), shallow (isolated component), mount (full DOM). Most components can be shallow rendered and tested in isolation. Enzyme allows for searching of the rendered component for testing (i.e. .find).

We will be using Mocha as the test runner. View the for further details.

When using Enzyme to render component via mount (full DOM), you can use as a headless browser since mount requires a DOM environment.

Enzyme
API Documentation
jsdom