-
Notifications
You must be signed in to change notification settings - Fork 544
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How would someone write automated tests for their site that uses SuperTokens? #115
Comments
BackendPeople will most likely not want to start a SuperTokens core server just to test their backend API.
const authHeaders = SuperTokensMock.getAuthHeaders("[email protected]");
const res = await fetch('/api/v1/users', {
headers: {
someHeaders,
...authHeaders
}
});
This approach allows developers to test their API easily without having troubles bypassing SuperTokens system. The downside is that it doesn't test if authentication/session management (/ permissions / roles in the future) work well with their system. Most likely, when using a 3rd party you want to trust them and not to implement redundant tests so that's fine. Front EndIn an end-to-end scenario that connects to a NodeJS backend, we would leverage the above which would be completely invisible to the front end. |
Interesting idea. Will think about this for the next release. |
I'm developing a service that uses Supertokens (managed hosting) and I'm interested in this. What's the current best practice for writing end-to-end tests? |
@neongreen the current way to do this is to:
|
The text was updated successfully, but these errors were encountered: