Skip to content

✅ test: add unit test for src/server/routers/lambda/agent.ts #6192

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

Closed

Conversation

gru-agent[bot]
Copy link
Contributor

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

Trigger Info

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

Summary

This PR introduces comprehensive unit tests for the agentRouter module, ensuring robust coverage of its functionalities. Key highlights include:

  • Mocking Dependencies: Mocked models (AgentModel, FileModel, KnowledgeBaseModel, SessionModel, UserModel) and services (AgentService) to isolate and test the router logic.

  • Test Cases:

    • createAgentFiles: Verifies the creation of agent files with specified configurations.

    • createAgentKnowledgeBase: Ensures proper creation of agent knowledge bases.

    • getAgentConfig: Tests retrieval of agent configurations, including handling of inbox sessions and default configurations.

    • getKnowledgeBasesAndFiles: Validates the combination of knowledge bases and files returned for an agent.

    • deleteAgentFile: Confirms deletion of agent files.

    • deleteAgentKnowledgeBase: Confirms deletion of agent knowledge bases.

    • toggleFile: Tests toggling the enabled state of files.

    • toggleKnowledgeBase: Tests toggling the enabled state of knowledge bases.

  • Edge Cases:

    • Handling scenarios where no user is found for inbox sessions.

    • Ensuring proper behavior when sessions or knowledge bases are missing.

This addition strengthens the reliability of the agentRouter by ensuring its methods behave as expected under various 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

Copy link

vercel bot commented Feb 15, 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 16, 2025 0:58am
lobe-chat-preview ⬜️ Ignored (Inspect) Visit Preview Feb 16, 2025 0:58am

@gru-agent gru-agent bot requested a review from arvinxx February 15, 2025 18:24
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Feb 15, 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 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.82%. Comparing base (588cba7) to head (657e4af).
Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6192      +/-   ##
==========================================
+ Coverage   91.80%   91.82%   +0.01%     
==========================================
  Files         668      670       +2     
  Lines       61144    61319     +175     
  Branches     3054     2874     -180     
==========================================
+ Hits        56134    56305     +171     
- Misses       5010     5014       +4     
Flag Coverage Δ
app 91.82% <ø> (+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.

Base automatically changed from fix/assisant to main February 16, 2025 00:29
Copy link
Contributor Author

gru-agent bot commented Feb 16, 2025

✅ Rebase TestGru PR Success

Type Change
Base Sha 588cba7...588cba7
Head Sha 52d8725...657e4af

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Feb 16, 2025
@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


🔄 Rebasing Testgru per ...

@gru-agent gru-agent bot force-pushed the gru/src-server-routers-lambda-agent-ts-1739643853052 branch from 52d8725 to 657e4af Compare February 16, 2025 00:29
Copy link

vercel bot commented Feb 16, 2025

Deployment failed with the following error:

Resource is limited - try again in 3 hours (more than 100, code: "api-deployments-free-per-day").

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:XL This PR changes 500-999 lines, ignoring generated files. labels Feb 16, 2025
@arvinxx arvinxx closed this Feb 16, 2025
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