Using jest for API route handlers
Unanswered
Scale parasitoid posted this in #help-forum
Scale parasitoidOP
I am using jest to unit test the route handlers, but it is not able to resolve the path.
Error:
Error:
Cannot find module '@/services' from 'app/api/products/route.ts'
> 1 | import { productsHandler } from "@/services";
at Resolver._throwModNotFoundError (node_modules/.pnpm/jest-resolve@29.7.0/node_modules/jest-resolve/build/resolver.js:427:11)
at Object.<anonymous> (app/api/products/route.ts:1:1)
at Object.<anonymous> (__tests__/app/api/products/product.test.ts:5:1)