Skip to content

test: Add unit test for projects/app/src/web/core/plugin/marketplace/api.ts#6301

Closed
gru-agent[bot] wants to merge 1 commit into
mainfrom
gru/projects-app-src-web-core-plugin-marketplace-api-ts-1768983168583
Closed

test: Add unit test for projects/app/src/web/core/plugin/marketplace/api.ts#6301
gru-agent[bot] wants to merge 1 commit into
mainfrom
gru/projects-app-src-web-core-plugin-marketplace-api-ts-1768983168583

Conversation

@gru-agent

@gru-agent gru-agent Bot commented Jan 21, 2026

Copy link
Copy Markdown
Contributor

Trigger Info

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

Summary

This PR introduces unit tests for the marketplace/api module in the FastGPT project. The tests cover the following API functions:

  1. getSystemInstalledPlugins:

    • Verifies that the GET request is made with the correct parameters.

    • Confirms the response matches the expected structure.

  2. getMarketplaceTools:

    • Tests the POST request with appropriate parameters.

    • Validates the returned data structure.

  3. getMarketplaceToolDetail:

    • Ensures the GET request is called with the correct tool ID.

    • Checks the response for expected tool details.

  4. getMarketPlaceToolTags:

    • Confirms the GET request retrieves the correct tags.

    • Validates the response structure.

  5. getMarketplaceDownloadURL:

    • Tests the GET request for a single tool's download URL.

    • Verifies the returned URL matches the expected value.

  6. getMarketplaceDownloadURLs:

    • Ensures the POST request retrieves download URLs for multiple tools.

    • Validates the response contains the correct URLs.

  7. getMarketplaceToolVersions:

    • Verifies the GET request retrieves tool version information.

    • Confirms the response matches the expected version data.

The tests use mocked GET and POST methods to simulate API calls and validate the behavior of the functions. This ensures the correctness of the marketplace API integration and improves test coverage for the module.

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 -> 7 🔺
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
Copy Markdown

Preview mcp_server Image:

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

@github-actions

Copy link
Copy Markdown

Preview sandbox Image:

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

@github-actions

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 25.88% 18750 / 72443
🔵 Statements 25.88% 18750 / 72443
🔵 Functions 38.81% 592 / 1525
🔵 Branches 71.8% 2012 / 2802
File CoverageNo changed files found.
Generated in workflow #3559 for commit 3159dd4 by the Vitest Coverage Report Action

@github-actions

Copy link
Copy Markdown

Preview fastgpt Image:

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

@FinleyGe FinleyGe closed this Jan 21, 2026
@c121914yu c121914yu deleted the gru/projects-app-src-web-core-plugin-marketplace-api-ts-1768983168583 branch February 2, 2026 11:42
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