The repository includes pre-written tests to verify your application works correctly. If all tests pass, your app is built properly!
-
Open your terminal in the project directory
-
Run the test command:
npm test- Wait for the tests to complete
You should see output like this:
PASS tests/pokemonService.test.js
PASS tests/api.test.js
Test Suites: 2 passed, 2 total
Tests: 25 passed, 25 total
All tests passing means your app is built correctly!
You'll see output showing which tests failed:
FAIL tests/api.test.js
● Pokemon API Endpoints › GET /api/pokemon › should return pokemon list
Expected: 200
Received: 500
This means something is wrong with your code. Check:
- File names - Are all files named correctly?
- File locations - Are files in the correct folders?
- Exports - Did you export all functions?
- Typos - Check for spelling mistakes in your code
-
Read the error message to find which test failed
-
The test name tells you what's broken:
GET /api/pokemon→ Check your routes and controllersgetPokemonDetails→ Check your service layerFailed to fetch→ Check your repository layer
-
Fix the issue in your code
-
Run tests again:
npm test- Repeat until all tests pass
- Check for linting errors:
npm run lint- If there are errors, fix them automatically:
npm run lint:fix- Check code formatting:
npm run format:check- If formatting is wrong, fix it:
npm run format- Run all checks together:
npm run lint && npm run format:check && npm test-
All commands should complete without errors
-
If everything passes, your app is ready!
- Stage your changes:
git add .- Commit with the conventional format:
git commit -m "test: verify all tests pass
Full Name: Juan Dela Cruz
Umindanao: juan.delacruz@email.com"- Replace the name and email with your own information
Let's put it all together and run the application!
Next: 11 - Running the App