Deliverables - Hybrid Assignments
Unit Testing
Due Date
Due before 6:00 pm on Friday October 9, 2020.
# Preparation
- Read the backgrounder module on JavaScript Testing. 15 minutes
- 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
- Download the ZIP file with the starter code.
- Create a new private GitHub repository called mad9135-f20-h2-unit-testing.
- Clone that repo to your laptop and copy the two starter files to that folder.
- Create a
.gitignorefile with at least.DS_Storeandnode_modulesin it. - Initialize your package.json file with
yarn init. - Add
jestas a dev-dependency.
yarn add --dev jest
- Update the scripts block of your
package.jsonfile to look like this ...
"scripts": {
"test": "jest"
}
- Follow the instructions inside
robot.test.jsto create 6 tests for the robot module. You will want to reference the Jest documentation on Using Matchers and the Expect API. - Run your tests in the terminal with
yarn test. - 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.

- After all your tests are working, push the commits up to GitHub.
- Invite GitHub user
rlmckenneyas a collaborator on your private repo. - Submit the URL of the code repo to the Brightspace assignment folder.