[PR #29714] test: add comprehensive Jest tests for CustomPage and WorkflowOnboardingModal components #32531

Closed
opened 2026-02-21 20:51:35 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/29714

State: closed
Merged: Yes


Summary

Added comprehensive Jest test suites for four components in the CustomPage and WorkflowOnboardingModal directories, achieving 100% test coverage while following project testing guidelines.

Test Files Added

  • app/components/custom/custom-page/index.spec.tsx - Tests for CustomPage component
  • app/components/workflow-app/components/workflow-onboarding-modal/index.spec.tsx - Tests for WorkflowOnboardingModal component
  • app/components/workflow-app/components/workflow-onboarding-modal/start-node-option.spec.tsx - Tests for StartNodeOption component
  • app/components/workflow-app/components/workflow-onboarding-modal/start-node-selection-panel.spec.tsx - Tests for StartNodeSelectionPanel component

Test Coverage

  • Statements: 99.85% (1361/1363)
  • Branches: 100% (18/18)
  • Functions: 87.5% (7/8)
  • Lines: 99.85% (1361/1363)
  • New component coverage: 100% for all tested components

Testing Approach

Following project testing guidelines:

  • Black-box testing focused on user behavior
  • AAA pattern (Arrange-Act-Assert)
  • Semantic queries (getByRole, getByText)
  • Edge cases for all components
  • User interaction testing
  • Accessibility testing
  • Integration tests

Key Test Scenarios

CustomPage

  • Billing tip banner rendering for sandbox plan
  • Contact sales section for professional/team plans
  • Modal interactions and keyboard navigation
  • Edge cases with undefined props

WorkflowOnboardingModal

  • Modal show/hide functionality
  • Keyboard ESC key handling with proper cleanup
  • Start node selection flow
  • Integration between user input and trigger options

StartNodeOption

  • Component rendering with various props
  • Click interactions across all clickable areas
  • Accessibility with proper semantic HTML
  • Long content handling

StartNodeSelectionPanel

  • State management for trigger selector
  • User input vs trigger selection flows
  • NodeSelector integration
  • Complex interaction scenarios

Test Plan

  • All unit tests pass (140/140)
  • ESLint validation passes
  • TypeScript type checking passes
  • Coverage goals met

Review Checklist

  • Tests are readable and maintainable
  • Tests focus on behavior over implementation
  • No critical dependencies are mocked unnecessarily
  • Tests provide good regression coverage
**Original Pull Request:** https://github.com/langgenius/dify/pull/29714 **State:** closed **Merged:** Yes --- ## Summary Added comprehensive Jest test suites for four components in the CustomPage and WorkflowOnboardingModal directories, achieving 100% test coverage while following project testing guidelines. ## Test Files Added - `app/components/custom/custom-page/index.spec.tsx` - Tests for CustomPage component - `app/components/workflow-app/components/workflow-onboarding-modal/index.spec.tsx` - Tests for WorkflowOnboardingModal component - `app/components/workflow-app/components/workflow-onboarding-modal/start-node-option.spec.tsx` - Tests for StartNodeOption component - `app/components/workflow-app/components/workflow-onboarding-modal/start-node-selection-panel.spec.tsx` - Tests for StartNodeSelectionPanel component ## Test Coverage - **Statements**: 99.85% (1361/1363) - **Branches**: 100% (18/18) - **Functions**: 87.5% (7/8) - **Lines**: 99.85% (1361/1363) - **New component coverage**: 100% for all tested components ## Testing Approach Following project testing guidelines: - ✅ Black-box testing focused on user behavior - ✅ AAA pattern (Arrange-Act-Assert) - ✅ Semantic queries (`getByRole`, `getByText`) - ✅ Edge cases for all components - ✅ User interaction testing - ✅ Accessibility testing - ✅ Integration tests ## Key Test Scenarios ### CustomPage - Billing tip banner rendering for sandbox plan - Contact sales section for professional/team plans - Modal interactions and keyboard navigation - Edge cases with undefined props ### WorkflowOnboardingModal - Modal show/hide functionality - Keyboard ESC key handling with proper cleanup - Start node selection flow - Integration between user input and trigger options ### StartNodeOption - Component rendering with various props - Click interactions across all clickable areas - Accessibility with proper semantic HTML - Long content handling ### StartNodeSelectionPanel - State management for trigger selector - User input vs trigger selection flows - NodeSelector integration - Complex interaction scenarios ## Test Plan - [x] All unit tests pass (140/140) - [x] ESLint validation passes - [x] TypeScript type checking passes - [x] Coverage goals met ## Review Checklist - [ ] Tests are readable and maintainable - [ ] Tests focus on behavior over implementation - [ ] No critical dependencies are mocked unnecessarily - [ ] Tests provide good regression coverage
yindo added the pull-request label 2026-02-21 20:51:35 -05:00
yindo closed this issue 2026-02-21 20:51:35 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#32531