Testing Node.js · Lecture 4
One real HTTP call
startCouponServer takes the database and listens on port 0. The test sends SAVE10 and checks that getCoupon saw that code and that the status is 200. It does not check that ten percent off 100 is 90. A body that is not JSON is 400, and the route is not called.
node --test lectures/04-http/server.test.js
Code: lectures/04-http. Node 24. No packages.