Hiii! Finally updated my learning section again 😄
This morning (yep, around 4AM lol), I finished my API testing starter using Mocha + Chai + Supertest. I had just wrapped up a video course on it the day before, so I wanted to try it out right away.
To make things easier, I included examples of all four common request methods: GET, POST, PUT, DELETE — with different types of chai.expect
assertions like:
Things I learned (but didn’t fully explain in the repo):
-
async/await
is useful for handling sequential processes, so your code doesn’t run out of order. --parallel
mode runs tests per file, not per test case. So if you have multiple test files, it can really help speed things up by running them at the same time.it.only()
is used when you want to run just one specific test case — but keep in mind, it won’t work in--parallel
mode.-
Mocha handles the test structure, Chai handles the assertions, and Supertest helps you make actual HTTP requests
Feel free to use or fork it—I've already explained the setup and examples in the GitHub repo here. Hope it’s clear and helpful! ✨