Is there a recommended way to test api routes? #2159
Unanswered
insanity54
asked this question in
Q&A
Replies: 2 comments
-
|
I recommend extracting the business logic into a separate function that allows you to test it without mocking |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
You can also test your api routes with https://github.com/Xunnamius/next-test-api-route-handler |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a Blitz app with some custom logic that is handled by an api route, e.g.
/api/fooIs there a recommended way to create unit tests for this api route? In other words, is there a way to test that
/api/fooresponds with a specific value?Beta Was this translation helpful? Give feedback.
All reactions