Jest e2e tests. Problem with getSession #4180
Unanswered
pwozniak1986
asked this question in
Help
Replies: 0 comments
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.
-
Hi.
I'm trying to make e2e test in my app which is using next-auth and prisma.
Most of endpoints utilize next-auth session in following way:
To be able to access the session during the tests, before all, the user and session object are created, csrf token is fetched. With csrf token and session token the cookie is created. The cookie is later provided with the
NextApiRequest
object bynode-mocks-http
to the endpoint however the next-authgetSession
method is not returning a valid session based on this request.What else has to be inside this request so the getSession returns a valid session?
Beta Was this translation helpful? Give feedback.
All reactions