francis.miko
TTCTheo's Typesafe Cult
•Created by francis.miko on 8/31/2023 in #questions
How does next13's /app routing api integrate Jest testing?
My test code looks like this:
And the types passed in by my POST are the native Request and Response types.
The result is this error:
expect(jest.fn()).toHaveBeenCalledWith(...expected)
Expected: 200
Number of calls: 0
Looks like the request is not being impersonated to run? thus not getting any response.3 replies
TTCTheo's Typesafe Cult
•Created by francis.miko on 8/13/2023 in #questions
How Next.js 13 middleware is used as error handling?
8 replies
TTCTheo's Typesafe Cult
•Created by francis.miko on 8/13/2023 in #questions
How Next.js 13 middleware is used as error handling?
I don't want to add a try catch module to each of my api codes. Doing so would defeat my original intention of using middleware to catch errors. So do you guys have any good insights?
8 replies
TTCTheo's Typesafe Cult
•Created by francis.miko on 8/13/2023 in #questions
How Next.js 13 middleware is used as error handling?
But this doesn't work, I can't catch related errors thrown by my api, for example my POST api:
8 replies
TTCTheo's Typesafe Cult
•Created by francis.miko on 8/13/2023 in #questions
How Next.js 13 middleware is used as error handling?
Here is my existing code
8 replies