Skip to content
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/routers/lambda/aiModel.ts #6088

Merged

Conversation

gru-agent[bot]
Copy link
Contributor

@gru-agent gru-agent bot commented Feb 13, 2025

Trigger Info

Trigger Type Triggered By Source File Assignment
Push arvinxx src/server/routers/lambda/aiModel.ts Detail

Summary

This PR introduces unit tests for the aiModelRouter module, ensuring comprehensive coverage of its functionalities. The tests validate the following operations:

  • Create AI Model: Verifies the creation of an AI model with the expected parameters.

  • Get AI Model by ID: Ensures retrieval of a specific AI model by its ID.

  • Get AI Provider Model List: Confirms fetching a list of models associated with a specific provider.

  • Remove AI Model: Tests the deletion of an AI model by ID and provider.

  • Update AI Model: Validates updating an AI model's attributes.

  • Toggle Model Enabled Status: Checks toggling the enabled status of a model.

  • Batch Toggle AI Models: Ensures batch toggling of multiple models' enabled statuses.

  • Batch Update AI Models: Verifies batch updates of multiple AI models.

  • Clear Models by Provider: Confirms clearing all models associated with a specific provider.

  • Clear Remote Models: Tests clearing remote models for a given provider.

Mock implementations are used for dependencies like AiModelModel, AiInfraRepos, and other modules to isolate the tests and focus on the router's behavior. This ensures robust validation of the aiModelRouter's functionality.

Tip

You can @gru-agent and leave your feedback. TestGru will make adjustments based on your input

Tip

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

@gru-agent gru-agent bot requested a review from arvinxx February 13, 2025 06:18
Copy link

vercel bot commented Feb 13, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
lobe-chat-preview ⬜️ Ignored (Inspect) Feb 13, 2025 6:18am

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Feb 13, 2025
@lobehubbot
Copy link
Member

👍 @gru-agent[bot]

Thank you for raising your pull request and contributing to our Community
Please make sure you have followed our contributing guidelines. We will review it as soon as possible.
If you encounter any problems, please feel free to connect with us.
非常感谢您提出拉取请求并为我们的社区做出贡献,请确保您已经遵循了我们的贡献指南,我们会尽快审查它。
如果您遇到任何问题,请随时与我们联系。

Copy link

codecov bot commented Feb 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.44%. Comparing base (257fda1) to head (36d04f5).
Report is 30 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6088      +/-   ##
==========================================
+ Coverage   92.43%   92.44%   +0.01%     
==========================================
  Files         661      662       +1     
  Lines       60005    60138     +133     
  Branches     3022     2834     -188     
==========================================
+ Hits        55463    55595     +132     
- Misses       4542     4543       +1     
Flag Coverage Δ
app 92.44% <ø> (+0.01%) ⬆️
server 97.90% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@arvinxx arvinxx merged commit 40df6c2 into main Feb 15, 2025
16 checks passed
@arvinxx arvinxx deleted the testgru-src-server-routers-lambda-aiModel.ts-1739427506046 branch February 15, 2025 04:11
@lobehubbot
Copy link
Member

❤️ 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.
项目的成长离不开用户反馈和贡献,感谢您的贡献! 如果您对 LobeHub 开发者社区感兴趣,请加入我们的 discord,然后私信 @arvinxx@canisminor1990。他们会邀请您加入我们的私密开发者频道。我们将会讨论关于 Lobe Chat 的开发,分享和讨论全球范围内的 AI 消息。

@lobehubbot
Copy link
Member

🎉 This PR is included in version 1.55.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants