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

PR Summary

This PR introduces unit tests for the handler function in create.ts, which is responsible for creating HTTP toolsets. The tests cover various scenarios, including manual and batch creation types, handling parent IDs, and error propagation. Key changes include:

  1. Export handler:

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

    • Added a new test file create.test.ts with comprehensive test cases using Vitest.

    • Mocked dependencies such as permission checks, MongoDB session handling, and utility functions.

    • Covered scenarios:

      • Manual creation without parentId.

      • Batch creation without parentId.

      • Creation with parentId using authApp.

      • Error handling for team app limit checks.

      • Error propagation from onCreateApp.

  3. Mocks:

    • Mocked external modules and functions to isolate the handler logic.

    • Ensured proper validation of inputs and outputs for each test case.

These changes improve the reliability and maintainability of the handler function by ensuring its behavior is thoroughly tested under different conditions.

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.19% 14835 / 58881
🔵 Statements 25.19% 14835 / 58881
🔵 Functions 33.65% 423 / 1257
🔵 Branches 73.05% 1402 / 1919
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
projects/app/src/pages/api/core/app/httpTools/create.ts 100% 100% 100% 100%
Generated in workflow #2422 for commit 9b71174 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_9b711748da61005295e1efd33c9bd39d8800e007

* 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:12
Copy link
Contributor Author

gru-agent bot commented Oct 10, 2025

✅ Rebase TestGru PR Success

Type Change
Base Sha 89e718f...89e718f
Head Sha b2e78b7...9b71174

@gru-agent gru-agent bot force-pushed the gru/projects-app-src-pages-api-core-app-httpTools-create-ts-1760088643540 branch from b2e78b7 to 9b71174 Compare October 10, 2025 12:13
Copy link

Preview fastgpt Image:

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

@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