Skip to content

✅ test: add unit test for src/services/message/server.ts#6961

Merged
arvinxx merged 1 commit intomainfrom
gru/src-services-message-server-ts-1741962708330
Apr 6, 2025
Merged

✅ test: add unit test for src/services/message/server.ts#6961
arvinxx merged 1 commit intomainfrom
gru/src-services-message-server-ts-1741962708330

Conversation

@gru-agent
Copy link
Contributor

@gru-agent gru-agent bot commented Mar 14, 2025

Trigger Info

Trigger Type Triggered By Source File Assignment
Push arvinxx src/services/message/server.ts Detail

Summary

This PR introduces unit tests for the ServerService class, specifically targeting the private toDbSessionId method. The tests cover various input scenarios to ensure the method behaves as expected. Key changes include:

  • Added a new test file server.test.ts under src/services/message/__tests__/.

  • Verified behavior for INBOX_SESSION_ID, ensuring it returns null.

  • Tested handling of non-inbox session IDs, including:

    • Undefined input.

    • Empty string input.

    • Special characters.

    • Numeric session IDs.

    • Null session IDs (with type casting to bypass type errors).

These tests improve the reliability and maintainability of the toDbSessionId method by validating its behavior across diverse input cases.

Coverage

The change in coverage value, such as: 0% -> 50%, indicates that the coverage was 0% before writing the tests and 50% after writing them.

https://web.dev/articles/ta-code-coverage

Type Change
lines 0% -> 0%
statements 0% -> 0%
functions 0% -> 0%
branches 0% -> 0%

Test Statuses

Status Change
passed 0 -> 7 🔺
failed 0 -> 0
skipped 0 -> 0
source ai

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

@vercel
Copy link

vercel bot commented Mar 14, 2025

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

3 Skipped Deployments
Name Status Preview Comments Updated (UTC)
lobe-chat-database ⬜️ Ignored (Inspect) Visit Preview Mar 14, 2025 2:32pm
lobe-chat-desktop ⬜️ Ignored (Inspect) Visit Preview Mar 14, 2025 2:32pm
lobe-chat-preview ⬜️ Ignored (Inspect) Visit Preview Mar 14, 2025 2:32pm

@gru-agent gru-agent bot requested a review from arvinxx March 14, 2025 14:32
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Mar 14, 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.
非常感谢您提出拉取请求并为我们的社区做出贡献,请确保您已经遵循了我们的贡献指南,我们会尽快审查它。
如果您遇到任何问题,请随时与我们联系。

@codecov
Copy link

codecov bot commented Mar 14, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 91.38%. Comparing base (59cafa0) to head (bcd09cb).
Report is 179 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6961      +/-   ##
==========================================
+ Coverage   91.31%   91.38%   +0.06%     
==========================================
  Files         732      732              
  Lines       69143    69143              
  Branches     4743     3202    -1541     
==========================================
+ Hits        63140    63188      +48     
+ Misses       6003     5955      -48     
Flag Coverage Δ
app 91.38% <ø> (+0.06%) ⬆️
server 97.49% <ø> (ø)

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.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@arvinxx arvinxx merged commit 2e5d830 into main Apr 6, 2025
19 checks passed
@arvinxx arvinxx deleted the gru/src-services-message-server-ts-1741962708330 branch April 6, 2025 06:13
@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.77.14 🎉

The release is available on:

Your semantic-release bot 📦🚀

bbbugg pushed a commit to bbbugg/lobe-chat that referenced this pull request Aug 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments