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/config/modelProviders/index.ts #6032

Closed

Conversation

gru-agent[bot]
Copy link
Contributor

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

Trigger Info

Trigger Type Triggered By Source Pull Request Assignment
Auto Rebase arvinxx 6029 Detail

Summary

This PR introduces unit tests for the filterEnabledModels and isProviderDisableBroswerRequest functions in the src/config/modelProviders module. The tests ensure the correctness of these utility functions by covering various scenarios:

  • filterEnabledModels Tests:

    • Verifies that only enabled models are returned based on the enabled property.

    • Handles cases where no models are enabled, chatModels is empty, or the enabled property is undefined.

  • isProviderDisableBroswerRequest Tests:

    • Confirms the function correctly identifies providers with disableBrowserRequest set to true.

    • Tests scenarios where the property is false, missing, or the provider is not found.

These tests improve the reliability and maintainability of the code by ensuring expected behavior under different conditions.

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 11, 2025 18:32
@gru-agent gru-agent bot mentioned this pull request Feb 11, 2025
8 tasks
Copy link

vercel bot commented Feb 11, 2025

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

2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
lobe-chat-database ⬜️ Ignored (Inspect) Feb 11, 2025 7:11pm
lobe-chat-preview ⬜️ Ignored (Inspect) Visit Preview Feb 11, 2025 7:11pm

@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.
非常感谢您提出拉取请求并为我们的社区做出贡献,请确保您已经遵循了我们的贡献指南,我们会尽快审查它。
如果您遇到任何问题,请随时与我们联系。

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

codecov bot commented Feb 11, 2025

Codecov Report

Attention: Patch coverage is 96.51163% with 3 lines in your changes missing coverage. Please review.

Project coverage is 92.18%. Comparing base (ee48e30) to head (a5149aa).
Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
src/libs/agent-runtime/AgentRuntime.ts 57.14% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             main    #6032     +/-   ##
=========================================
  Coverage   92.18%   92.18%             
=========================================
  Files         656      659      +3     
  Lines       59643    59729     +86     
  Branches     4320     2957   -1363     
=========================================
+ Hits        54981    55064     +83     
- Misses       4662     4665      +3     
Flag Coverage Δ
app 92.18% <96.51%> (+<0.01%) ⬆️
server 98.01% <ø> (ø)

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 closed this Feb 12, 2025
@arvinxx arvinxx deleted the testgru-src-config-modelProviders-index.ts-1739298756712 branch February 16, 2025 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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