Skip to content

Conversation

gru-agent[bot]
Copy link
Contributor

@gru-agent gru-agent bot commented Aug 7, 2025

Trigger Info

Trigger Type Triggered By Source Pull Request Assignment
PR Created c121914yu 5407 Detail

Summary

This PR introduces unit tests for the controller.ts file in the dataset data service. The following changes are included:

  1. New Test File:

    • Added controller.test.ts to test the functionality of the dataset data controller.
  2. Test Coverage:

    • formatIndexes:

      • Tests for formatting indexes with and without input indexes.
    • insertData2Dataset:

      • Tests for successful data insertion.

      • Validation for missing required fields.

      • Validation for teamId and tmbId being the same.

    • updateData2Dataset:

      • Tests for successful data updates.

      • Validation for handling non-existent data.

    • deleteDatasetData:

      • Tests for successful data deletion with and without associated images.
  3. Mocking:

    • Mocked dependencies such as MongoDatasetData, MongoDatasetDataText, insertDatasetDataVector, deleteDatasetDataVector, deleteDatasetImage, and other utility functions to isolate and test the controller logic.
  4. Export Adjustment:

    • Exported formatIndexes from controller.ts to facilitate testing.

These tests ensure the robustness of the dataset data controller by validating its core functionalities 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% -> 87.42% 🔺
functions 0% -> 100% 🔺
statements 0% -> 87.42% 🔺
branches 0% -> 83.58% 🔺
source program

Test Statuses

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

@gru-agent gru-agent bot requested a review from c121914yu August 7, 2025 15:43
@gru-agent gru-agent bot mentioned this pull request Aug 7, 2025
Copy link

github-actions bot commented Aug 7, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 22.85% 12859 / 56259
🔵 Statements 22.85% 12859 / 56259
🔵 Functions 31.25% 366 / 1171
🔵 Branches 69.13% 999 / 1445
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
projects/app/src/service/core/dataset/data/controller.ts 87.42% 83.58% 100% 87.42% 96-100, 125-136, 275-276, 311-333, 369, 389
Generated in workflow #1716 for commit 030ee63 by the Vitest Coverage Report Action

Copy link

github-actions bot commented Aug 7, 2025

Preview sandbox Image:

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

Copy link

github-actions bot commented Aug 7, 2025

Preview mcp_server Image:

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

@c121914yu c121914yu closed this Aug 11, 2025
@c121914yu c121914yu deleted the gru/projects-app-src-service-core-dataset-data-controller-ts-1754581421962 branch August 12, 2025 14:29
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