Task 7: Running the Auto-grading Tests
Run the Tests
This project uses unit tests to help auto-grade your work. The tests should pass based on the files you create and their behavior.
Run the tests when you reach this section of the instructions. You may run them as you work on the project. These tests are looking to see if your components render. They do not provide help in creating the project.
In order to pass this assignment, you must pass the workflow tests in GitHub Actions .
To Run the Tests in Your Terminal
Use these steps to start the tests:
- In the terminal,
cd
into the project directory. - Run the following commands to start the tests:
npm test
You should see the following BEFORE you do any of the project:
AFTER completing your project, you should see the following test results:
Testing Information
"Final App function should contain a BANNER with title"
tests verify that you created a Banner
component and it contains a title of sorts. In this case, it says “Orbit Report”
"Final App function should contain 4 BUTTONS: Low, Medium, High, and All Orbits"
tests verify the behavior of your application. The buttons will not render in the App
function if you don’t code them properly.
"Final App function should contain TABLE with values in both headers and cells"
tests use a testing data set to check the behavior of your table. The test data is passed, and should be rendered into the table correctly using your map
functions.
Troubleshooting Vitest
Vite uses Vitest for testing React applications. It should already be part of your project. Vitest is configured in such a way that the tests are the exact same for Vitest and Jest, but it runs slightly differently and will have different output.
If you are not able to get the tests to run, make sure you are running the command inside the project repo.
Vitest will wait for you to change a file before re-running any tests. If you are trying to make changes and the tests aren’t re-running, check that you have saved those changes and exit Vitest with either
q
orCtrl+C
and runnpm test
to restart.