Hey folks. Just wondering the best way to tackle t...
# support-questions
j
Hey folks. Just wondering the best way to tackle testing with super tokens. In my fastify tests I actually generate a JWT and send the request in my test. Will post a screenshot. Ideas how to do a similar thing with supertokens?
r
Well.. with supertokens it's a little more complex. You need to call the login API which will generate cookies and send it in the response as cookies. You can then extract those cookies and add it to your request
j
Is there any way to 'mock' core?
r
not yet easily unfortunatrly. So you will have to run the core as well - you can do so via its in memory db
and here is an example of how you can do the cookie extraction stuff in your test: https://github.com/supertokens/supertokens-node/blob/master/test/framework/fastify.test.js#L44
j
Ok nice. I might see if I can create a different approach to start with where i put
verifySession()
on the req via a plugin. For tests I will return the mocked data, for real will use the supertokens function