Skip to content

Conversation

@gru-agent
Copy link
Contributor

@gru-agent gru-agent bot commented Nov 19, 2025

Trigger Info

Trigger Type Triggered By Source Pull Request Assignment
Ready for Review FinleyGe 5957 Detail

Summary

This PR introduces unit tests for the handler function in the installed.ts API endpoint, ensuring its functionality and robustness. Key changes include:

  1. Exporting the handler function:

    • The handler function in installed.ts is now explicitly exported to facilitate testing.
  2. Unit Tests:

    • Added a new test file installed.test.ts under test/cases/pages/api/core/plugin/admin/marketplace/.

    • Mocked dependencies:

      • APIGetSystemToolList from @fastgpt/service/core/app/tool/api.

      • authSystemAdmin from @fastgpt/service/support/permission/user/auth.

    • Test cases cover:

      • Returning an empty list when no tools are installed.

      • Returning a list of installed tools with their id and version.

      • Correctly removing the systemTool- prefix from tool IDs.

      • Handling tools with IDs not starting with the systemTool- prefix.

These changes ensure the handler function behaves as expected under various scenarios and edge 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% -> 100% 🔺
functions 100% -> 100%
statements 0% -> 100% 🔺
branches 100% -> 100%
source program

Test Statuses

Status Change
passed 0 -> 4 🔺
failed 0 -> 0
skipped 0 -> 0
source program

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

@github-actions
Copy link

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 25.66% 16314 / 63577
🔵 Statements 25.66% 16314 / 63577
🔵 Functions 34.47% 482 / 1398
🔵 Branches 70.65% 1546 / 2188
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
projects/app/src/pages/api/core/plugin/admin/marketplace/installed.ts 100% 100% 100% 100%
Generated in workflow #2825 for commit d129a4d by the Vitest Coverage Report Action

@github-actions
Copy link

Preview sandbox Image:

registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-pr:fatsgpt_sandbox_d129a4d15ab360aa7991fec4b4e508c51af65ffe

@github-actions
Copy link

Preview mcp_server Image:

registry.cn-hangzhou.aliyuncs.com/fastgpt/fastgpt-pr:fatsgpt_mcp_server_d129a4d15ab360aa7991fec4b4e508c51af65ffe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants