/Testing

Unit Testing JavaScript

Primary LanguageJavaScript

Testing

Topics:

Project Description

Welcome to the wonderful world of automated testing, specifically unit testing. Whether this is immediately clear to you or not, you have already familiarized yourselves with this process, only, the tests have been written for you beforehand.

Now we start on the other side of the fence, where you have no tests, only working code. The goal of this sprint is to get you familiar with writing unit tests for JavaScript code.

Assignment

  • Use yarn to install the necessary dependencies from the package.json file.
  • type yarn test to start the test runner.
  • open the basic-javascript folder and use project-1.spec.js to write tests for the functions inside project-1.js.
  • use project-2.spec.js to write tests for the functions inside project-2.js.

As you write your tests, bugs in the code may be revealed, feel free to correct and refactor the source code to satisfy your tests.

Stretch Goal

Open the advanced-javascript folder and write tests for the arrays.js and object.js files inside the corresponding *.spec.js files.