-
-
Notifications
You must be signed in to change notification settings - Fork 11.8k
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/services/aiModel/server.ts #6090
✅ test: add unit test for src/services/aiModel/server.ts #6090
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
👍 @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 #6090 +/- ##
==========================================
+ Coverage 92.43% 92.47% +0.04%
==========================================
Files 661 661
Lines 60005 60005
Branches 3022 4410 +1388
==========================================
+ Hits 55463 55488 +25
+ Misses 4542 4517 -25
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.53.9 🎉 The release is available on: Your semantic-release bot 📦🚀 |
…obehub#6090) Co-authored-by: gru-agent[bot] <185149714+gru-agent[bot]@users.noreply.github.com>
Trigger Info
Summary
This PR introduces unit tests for the
ServerService
class, ensuring the correctness of its methods that interact with thelambdaClient
for AI model management. The following functionalities are covered:AI Model Creation: Verifies the
createAiModel
method calls the appropriate client mutation with the correct parameters.Fetching AI Provider Model List: Tests the
getAiProviderModelList
method to ensure it queries the client with the correct provider ID.Fetching AI Model by ID: Confirms the
getAiModelById
method queries the client with the correct model ID.Toggling Model Enabled State: Validates the
toggleModelEnabled
method calls the client mutation with the correct parameters.Updating AI Model: Ensures the
updateAiModel
method sends the correct payload to the client mutation.Batch Updating AI Models: Tests the
batchUpdateAiModels
method for proper client interaction with a list of models.Batch Toggling AI Models: Verifies the
batchToggleAiModels
method toggles multiple models' states correctly.Clearing Models by Provider: Confirms the
clearModelsByProvider
method interacts with the client to clear models for a specific provider.Clearing Remote Models: Ensures the
clearRemoteModels
method clears remote models for a given provider.Updating AI Model Order: Validates the
updateAiModelOrder
method updates the sort order of models correctly.Deleting AI Model: Tests the
deleteAiModel
method to ensure it removes a model using the correct parameters.Mocks for
lambdaClient
are used to isolate the tests, and all methods are verified to call the expected client functions with the correct arguments. This ensures robust coverage for theServerService
class.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