-
-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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: add unit test for src/server/services/nextAuthUser/index.ts #6344
✅ test: add unit test for src/server/services/nextAuthUser/index.ts #6344
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
👍 @gru-agent[bot] Thank you for raising your pull request and contributing to our Community |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #6344 +/- ##
==========================================
+ Coverage 91.41% 91.48% +0.06%
==========================================
Files 688 689 +1
Lines 62895 62940 +45
Branches 4356 3128 -1228
==========================================
+ Hits 57497 57578 +81
+ Misses 5398 5362 -36
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
❤️ Great PR @gru-agent[bot] ❤️ The growth of project is inseparable from user feedback and contribution, thanks for your contribution! If you are interesting with the lobehub developer community, please join our discord and then dm @arvinxx or @canisminor1990. They will invite you to our private developer channel. We are talking about the lobe-chat development or sharing ai newsletter around the world. |
🎉 This PR is included in version 1.62.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
…scenarios. (lobehub#6344) Co-authored-by: gru-agent[bot] <185149714+gru-agent[bot]@users.noreply.github.com>
Trigger Info
Summary
This PR introduces unit tests for the
NextAuthUserService
class, specifically focusing on thesafeUpdateUser
method. The tests cover the following scenarios:Successful User Update: Verifies that the user is updated correctly when found, ensuring the appropriate methods are called and the response is as expected.
User Not Found: Handles the case where no user is found for the given account, ensuring a warning is logged and the response indicates success.
Error Handling: Ensures that errors during the user update process are properly thrown and handled.
Key changes include:
Mocking dependencies such as
UserModel
,serverDB
, andpino
logger.Adding test cases to validate different outcomes of the
safeUpdateUser
method.Ensuring proper logging and response structure in all scenarios.
Tip
You can
@gru-agent
and leave your feedback. TestGru will make adjustments based on your inputTip
You can
@gru-agent rebase
to rebase the PR.Tip
You can
@gru-agent redo
to reset or rebase before redoing the PR.Tip
To modify the test code yourself, click here Edit Test Code