Skip to content

bkrem/unit-testing-tutorial

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Quandoo Unit Testing Tutorial

Enzyme basics

  • render types

Jest basics

  • expect().[comparatorMethod]
  • Putting it together with enzyme; see basic.test.js

Testing props with StyledComponents

  • renderedComponent.props()
  • renderedComponent.find()
  • DRY: setup()

Testing event handlers

  • events.test.js

Mocking modules

mocking.test.js

Mounting / Testing Lifecycle events

lifecycle.test.js

Testing Higher-Order Components

Gotchas

  • Object comparison, toEqual + expect.objectContaining, not toBe
  • If spying on prototype object (or in doubt), jest.clearAllMocks() between each test

Future

  • Testing mock-heavy containers
  • Testing sagas (i.e. async/generator functions)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published