Skip to content

Latest commit

 

History

History
21 lines (14 loc) · 1.34 KB

eventonica-test-frontend.md

File metadata and controls

21 lines (14 loc) · 1.34 KB

Eventonica - Testing with Jest

Primary Goals

  • Practice writing tests with Jest
  • Catch any bugs in your project's object-oriented code

Overview

Now that you've put your frontend together, you'll write Jest tests to ensure your code works as expected.

Don't worry about testing React components - today you'll focus on testing the functions you've written.

Instructions for adding tests

  1. Go back to your User.js and Events.js files, and refamiliarize yourself with what you did there. We will be adding Jest tests for each function.
  2. Create a test folder, and start with 2 new files: one for Users and one for Events. Our Jest outline can remind you how to structure this.
  3. In your project root, run jest (it will start your tests).
  4. A lot of them will fail or not be found, and your challenge is to fix them. Debug why the tests are failing and update the Jest code and/or your classes to make the tests pass. Every time you make a fix, run jest again to check your tests. This might take a while but is good practice for debugging both your tests and your code.
  5. When you get the existing tests working, add tests for other functions you have implemented.
  6. Add at least one more test of your choice. What else could be useful to test in your code?