Skip to content

test: add unit tests for RagPipeline components#30429

Merged
iamjoel merged 9 commits intomainfrom
test/rag-pipeline
Jan 4, 2026
Merged

test: add unit tests for RagPipeline components#30429
iamjoel merged 9 commits intomainfrom
test/rag-pipeline

Conversation

@CodingOnStar
Copy link
Contributor

Summary

  • Introduced comprehensive test suites for RagPipelinePanel, PublishAsKnowledgePipelineModal, and TestRunPanel, covering rendering, state management, and user interactions.
  • Added tests for the preparation and result components, ensuring proper handling of various states and edge cases.
  • Mocked external dependencies to isolate tests and validate component behavior under different scenarios.
  • Implemented accessibility tests to ensure compliance and improve user experience.
  • Ensured integration tests validate complete workflows for the RagPipeline components.

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
CodingOnStar added 5 commits December 30, 2025 15:23
- Introduced comprehensive test suites for RagPipelineHeader, covering rendering, memoization, and integration tests. - Added tests for Publisher component, including rendering, state management, and user interactions. - Mocked external dependencies and context for isolated testing. - Ensured edge cases and error handling are covered in both components.
- Introduced comprehensive test suites for ChunkCard and ChunkCardList, covering rendering, props variations, memoization, and edge cases. - Implemented tests for different chunk types including text, QA, and parent-child. - Ensured proper handling of word count calculations and position ID assignments. - Added integration tests to validate complete workflows for chunk rendering.
…ponents - Introduced comprehensive test suites for InputFieldEditorPanel, covering rendering, props variations, user interactions, and edge cases. - Added tests for InputFieldForm, including rendering, state management, and callback stability. - Mocked external dependencies and ensured proper handling of various input types and configurations. - Implemented tests for utility functions related to form data conversion and validation.
… components - Introduced comprehensive test suites for InputFieldPanel, covering rendering, state management, and user interactions. - Added tests for FieldList, including rendering, user interactions, and handling of duplicate variable names. - Implemented tests for PreviewPanel, validating rendering, state management, and integration with child components. - Mocked external dependencies to ensure isolated testing and proper handling of various input types and configurations. - Ensured edge cases and error handling are covered across all components.
- Introduced comprehensive test suites for RagPipelinePanel, PublishAsKnowledgePipelineModal, and TestRunPanel, covering rendering, state management, and user interactions. - Added tests for the preparation and result components, ensuring proper handling of various states and edge cases. - Mocked external dependencies to isolate tests and validate component behavior under different scenarios. - Implemented accessibility tests to ensure compliance and improve user experience. - Ensured integration tests validate complete workflows for the RagPipeline components.
@CodingOnStar CodingOnStar marked this pull request as ready for review December 31, 2025 08:40
Copilot AI review requested due to automatic review settings December 31, 2025 08:40
@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Dec 31, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @CodingOnStar, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the stability and reliability of the RAG pipeline by introducing a comprehensive suite of unit and integration tests. The new tests cover critical UI components, their interactions, data handling, and edge cases, ensuring that future changes can be made with greater confidence and reducing the likelihood of regressions. This effort aims to improve the overall quality and maintainability of the RAG pipeline's frontend.

Highlights

  • Comprehensive Test Coverage: Introduced extensive unit and integration test suites for core RAG Pipeline components, including RagPipelinePanel, PublishAsKnowledgePipelineModal, and TestRunPanel.
  • Component-Specific Testing: Added detailed tests for ChunkCardList, QAItem, InputFieldForm, InputFieldEditorPanel, FieldList, Preparation, Result, and their sub-components, ensuring proper rendering, state management, and user interactions.
  • Robust Validation: Implemented tests covering various scenarios such as prop variations, memoization behavior, callback stability, and edge cases (e.g., empty data, long strings, special characters, unicode).
  • API and Hook Integration: Verified the correct integration and behavior of API calls and custom hooks within the tested components, ensuring data flow and state updates are handled as expected.
  • Accessibility and UI Consistency: Included accessibility tests for form inputs and buttons, and ensured consistent UI rendering across different states and data types.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces comprehensive unit test coverage for RagPipeline components, focusing on the test run panel, preparation workflow, and input field preview functionality. The test suite validates component rendering, state management, user interactions, and edge cases using mocked dependencies to ensure isolated testing.

Key changes:

  • Added tests for preparation flow components including data source selection, document processing, and step navigation
  • Implemented tests for test run panel tabs, result preview, and tracing functionality
  • Created tests for input field preview panel with datasource and form handling
  • Ensured accessibility and integration testing across all components

Reviewed changes

Copilot reviewed 13 out of 18 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
web/app/components/rag-pipeline/components/panel/test-run/preparation/index.spec.tsx Comprehensive test coverage for preparation component including hooks, state management, data source switching, and step navigation
web/app/components/rag-pipeline/components/panel/test-run/preparation/document-processing/index.spec.tsx Tests for document processing component covering form rendering, validation, API integration, and user interactions
web/app/components/rag-pipeline/components/panel/test-run/preparation/data-source-options/index.spec.tsx Tests for data source option cards and selection behavior including auto-selection and callback handling
web/app/components/rag-pipeline/components/panel/test-run/preparation/actions/index.spec.tsx Tests for action buttons covering disabled states, user interactions, and callback stability
web/app/components/rag-pipeline/components/panel/test-run/index.spec.tsx Tests for test run panel header, result tabs, preview components, and utility functions
web/app/components/rag-pipeline/components/panel/input-field/preview/index.spec.tsx Tests for input field preview panel including datasource selection, form rendering, and floating right behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a comprehensive suite of unit and integration tests for the RagPipeline components, significantly improving test coverage and code reliability. The tests are well-structured, covering rendering, state management, user interactions, and various edge cases. The use of test data factories and extensive mocking of dependencies is a great practice for creating isolated and stable tests. I've identified a few areas for improvement, mainly focused on making test selectors more robust and adding assertions to a few tests that currently lack them. Overall, this is a high-quality contribution.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jan 4, 2026
@iamjoel iamjoel merged commit 47b8e97 into main Jan 4, 2026
14 checks passed
@iamjoel iamjoel deleted the test/rag-pipeline branch January 4, 2026 10:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer size:XXL This PR changes 1000+ lines, ignoring generated files.

3 participants