Replies: 1 comment
-
Hey @Annada9 it's difficult to say without looking at the code, but you could always export you handler without the middleware and then test them independently. Here's an example: https://github.com/hobochild/boiler/blob/master/__tests__/pages/api/logout.test.js You'll see line 22-25 add the session to the request and "login" the user manually rather than using the middleware. |
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.
-
I want to write Integration tests for Next JS api. My Next JS api is wrapped with middleware handler which authenticates the user. Can anyone please suggest how to achieve the same?
Beta Was this translation helpful? Give feedback.
All reactions