Skip to content

Demonstrating dummies, mocks, stubs and spies in Jest

Notifications You must be signed in to change notification settings

nadia643/test-doubles

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Test Doubles

Example tests demonstrating using the magical jest.fn() to create dummies, mocks, stubs and spies.

The Kennel constructor function expects objects in the animals array to conform to an interface, which the Animal constructor implements.

Using jest.fn, we can test the Kennel constructor in isolation without relying on any external implementations of the expected interface (i.e. Animal)

Setup

  • clone the repository: git clone git@github.com:MCRcodes/test-doubles.git
  • install dependencies: npm install

Running Tests

  • npm test runs the unit tests with Jest

About

Demonstrating dummies, mocks, stubs and spies in Jest

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%