Unit testing Next.js API routes
Unit testing Next.js API routes is possible with jest and straightforward once you see an example.
Straight from the Next.js docs, API route handlers look like this:
// pages/api/user.js
export default (req, res) => {
res.statusCode = 200;
res.se...
huniko519.hashnode.dev2 min read