how to increase test coverage for a controller with try & catch using Supertest?

Viewed 29

with the following code, do you know how to cover line 7 with a jest and supertest?

1 const apiController: RequestHandler = async (req, res, next) => {
2   try {
3     const { x } = req.body;
4     const response = await apiService(x);
5     res.json({ response });
6   } catch (error) {
7     next(error);
8   }
9 };
0 Answers
Related