Skip to content

test: Add unit test for projects/app/src/web/core/ai/channel.ts #4991

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

gru-agent[bot]
Copy link
Contributor

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

Trigger Info

Trigger Type Triggered By Source Pull Request Assignment
PR Created ctrlz526 4990 Detail

Summary

This PR updates the channel.api test suite to enhance the testing of the getDashboardV2 function. Key changes include:

  1. Modification of Test Data Structure:

    • Replaced models with summary in the test data structure to align with the updated API response format.
  2. Addition of New Test Case:

    • Added a new test case to validate the getDashboardV2 function when fetching dashboard data with a minute timespan.

    • Mocked API response includes a summary array containing details such as model, tokens, price, and count.

These changes ensure the test suite accurately reflects the current API behavior and improves coverage for different timespan scenarios.

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 98.43% -> 98.43%
functions 100% -> 100%
statements 98.43% -> 98.43%
branches 94.59% -> 94.73% 🔺
source program

Test Statuses

Status Change
passed 14 -> 15 🔺
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

Preview mcp_server Image: ghcr.io/labring/fastgpt-pr:fatsgpt_mcp_server_ade48efd3a6d0977a36ee6c0a361209ee9ccee8e

Copy link

Preview sandbox Image: ghcr.io/labring/fastgpt-pr:fatsgpt_sandbox_ade48efd3a6d0977a36ee6c0a361209ee9ccee8e

Copy link

github-actions bot commented Jun 10, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 21.94% 11937 / 54387
🔵 Statements 21.94% 11937 / 54387
🔵 Functions 29.95% 331 / 1105
🔵 Branches 66.74% 847 / 1269
File CoverageNo changed files found.
Generated in workflow #1116 for commit 4beb2fb by the Vitest Coverage Report Action

Copy link

Preview fastgpt Image: ghcr.io/labring/fastgpt-pr:fatsgpt_ade48efd3a6d0977a36ee6c0a361209ee9ccee8e

@gru-agent gru-agent bot force-pushed the gru/projects-app-src-web-core-ai-channel-ts-1749541326060 branch from ade48ef to 4beb2fb Compare June 11, 2025 08:29
Copy link

Preview mcp_server Image: ghcr.io/labring/fastgpt-pr:fatsgpt_mcp_server_4beb2fb4dd4a6d0ad070fd12a7d64cf79e05cc6d

Copy link

Preview sandbox Image: ghcr.io/labring/fastgpt-pr:fatsgpt_sandbox_4beb2fb4dd4a6d0ad070fd12a7d64cf79e05cc6d

Copy link

Preview fastgpt Image: ghcr.io/labring/fastgpt-pr:fatsgpt_4beb2fb4dd4a6d0ad070fd12a7d64cf79e05cc6d

@c121914yu c121914yu merged commit cc5e46c into main Jun 11, 2025
8 checks passed
@c121914yu c121914yu deleted the gru/projects-app-src-web-core-ai-channel-ts-1749541326060 branch June 11, 2025 10:23
newfish-cmyk pushed a commit to newfish-cmyk/FastGPT that referenced this pull request Jun 12, 2025
… summary instead of models. (labring#4991)

Co-authored-by: gru-agent[bot] <185149714+gru-agent[bot]@users.noreply.github.com>
dreamer6680 pushed a commit to dreamer6680/FastGPT1 that referenced this pull request Jun 12, 2025
… summary instead of models. (labring#4991)

Co-authored-by: gru-agent[bot] <185149714+gru-agent[bot]@users.noreply.github.com>
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