Deliverables - Hybrid Assignments

Unit Testing

Due Date

Due before 6:00 pm on Friday October 9, 2020.

# Preparation

  1. Read the backgrounder module on JavaScript Testing. 15 minutes
  2. Watch the video tutorial on React testing and debugging with Jest. 1.5 hours

# Instructions

You have been provided with a ZIP file containing two starter files:

robot.js
robot.test.js

The first, robot.js, contains a working JavaScript module. Do not edit this file.

The second, robot.test.js, contains the scaffolding for a Jest test suite. Following the comment instructions, you will write the designated tests for the robot.js module.

# Steps

  1. Download the ZIP file with the starter code.
  2. Create a new private GitHub repository called mad9135-f20-h2-unit-testing.
  3. Clone that repo to your laptop and copy the two starter files to that folder.
  4. Create a .gitignore file with at least .DS_Store and node_modules in it.
  5. Initialize your package.json file with yarn init.
  6. Add jest as a dev-dependency.
yarn add --dev jest
  1. Update the scripts block of your package.json file to look like this ...
"scripts": {
    "test": "jest"
}
  1. Follow the instructions inside robot.test.js to create 6 tests for the robot module. You will want to reference the Jest documentation on Using Matchers and the Expect API.
  2. Run your tests in the terminal with yarn test.
  3. As you successfully complete each test, create a git commit.

# Submission

  • Compare the output report from your tests with this image. It should show 6 passed tests.

screenshot of completed jest report

  • After all your tests are working, push the commits up to GitHub.
  • Invite GitHub user rlmckenney as a collaborator on your private repo.
  • Submit the URL of the code repo to the Brightspace assignment folder.
Last Updated: : 10/3/2020, 3:36:41 PM