All files / src/routes/users_routes user_addToShoppingCart_post.js

83.33% Statements 5/6
50% Branches 2/4
100% Functions 1/1
83.33% Lines 5/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16          3x 3x 3x 3x 3x            
import UsersController from "../../controllers/users-controllers/UsersController.js";
import asyncRouteHandler from "../../utilities/asyncRouteHandler.js";
 
export default asyncRouteHandler(
    async function user_shoppingCart_post(req, res) {
        const { addToShoppingCart } = UsersController;
        const { productId } = req.body
        if (productId) {
            const response = await addToShoppingCart(req.userId, req.body);
            res.status(response ? 200 : 400).json(response);
        } else E{
            res.status(400).json();
        }
    }
)