Skip to content

Conversation

gru-agent[bot]
Copy link
Contributor

@gru-agent gru-agent bot commented Oct 10, 2025

Trigger Info

Trigger Type Triggered By Source Pull Request Assignment
Ready for Review newfish-cmyk 5743 Detail

Summary

This PR introduces unit tests for the handler function in the runTool.ts file. The key changes and additions include:

  • Exporting the handler function: The handler function is now exported to facilitate testing.

  • Unit tests for handler: A new test file, runTool.test.ts, has been added to cover various scenarios for the handler function. The tests include:

    • Verifying that runHTTPTool is called with the correct parameters.

    • Ensuring the method defaults to POST when not provided.

    • Handling cases where optional fields (customHeaders, headerSecret, staticParams, staticHeaders, staticBody) are missing.

    • Validating that all values are passed through correctly.

    • Propagating errors from runHTTPTool when it fails.

  • Mocking runHTTPTool: The runHTTPTool function from @fastgpt/service/core/app/http is mocked to simulate its behavior during testing.

These changes ensure that the handler function is thoroughly tested for correctness and robustness.

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 0% -> 100% 🔺
statements 0% -> 100% 🔺
branches 0% -> 100% 🔺
source program

Test Statuses

Status Change
passed 0 -> 5 🔺
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

Copy link

github-actions bot commented Oct 10, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 25.15% 14810 / 58881
🔵 Statements 25.15% 14810 / 58881
🔵 Functions 33.65% 423 / 1257
🔵 Branches 72.96% 1395 / 1912
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
projects/app/src/pages/api/core/app/httpTools/runTool.ts 100% 100% 100% 100%
Generated in workflow #2423 for commit 3a8778b by the Vitest Coverage Report Action

Copy link

github-actions bot commented Oct 10, 2025

Preview mcp_server Image:

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

* add manual create http toolset

* optimize code

* optimize

* fix

* fix
@c121914yu c121914yu changed the base branch from main to v4.13.2-dev October 10, 2025 12:13
Copy link
Contributor Author

gru-agent bot commented Oct 10, 2025

✅ Rebase TestGru PR Success

Type Change
Base Sha 89e718f...89e718f
Head Sha ea5ee38...3a8778b

@gru-agent gru-agent bot force-pushed the gru/projects-app-src-pages-api-core-app-httpTools-runTool-ts-1760088489650 branch from ea5ee38 to 3a8778b Compare October 10, 2025 12:13
Copy link

Preview fastgpt Image:

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

@c121914yu c121914yu force-pushed the v4.13.2-dev branch 2 times, most recently from 372813e to af88002 Compare October 13, 2025 08:36
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.

1 participant