-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
test(client): initial Jest + RTL setup #1992
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/nextauthjs/next-auth/6F6GnaMgbRJspdiytvqSeZZkpcAY |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! LGTM 👍
I've always wanted to try out msw
!
Whats up with lots of these actions failing? They seem to be throwing errors about the I was about to push mine, but I see we're still using the @lluia can you push your |
@ndom91 I regenerated the 🔒 file, and the CI seems happy now 😁 |
@lluia Alright awesome! Good work!! I'm so happy that tests for this anddd the adapters are slowly but surely coming together 🍻🚀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few comments 💭
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
…s#1992) * test(client): initial Jest + RTL setup * test(client): add tests for `getSession` * test(client): document expect cases and fix regex * test(client): small refactors * chore(npm): re-generate package-lock.json * test(client): initial test for `signIn` * test(client): refactor session tests for consistency * test(client): credentials/email signin scenarios * test(client): finish sign-in tests * chore(github): add test to ci * test(client): refactor and extend use cases * test(client): sign-out tests * refactor(client): code review suggestions (1) * test(client): add few more sign-in/sign-out cases * test(client): broadcasting session events * fix(client): handle fetch providers error
Reasoning 💡
This PR adds the initial unit/integration test setup with Jest + RTL + MSW.
As a proof of concept, we have covered the existing acceptance criteria for
signIn()
andgetSession
from the client module:next-auth/client
. The tests have been written in a fashion that mimics how users of this library will use these functions in the context o a React application.I have also the tests to the CI, have a look at the workflow (I feel we need to clean the actions soon) 🤔
...
Checklist 🧢
DocumentationReady to be mergedAffected issues 🎟
Fixes #1937