-
Notifications
You must be signed in to change notification settings - Fork 254
feat: added computation for in progress status & added tests #3306
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
feat: added computation for in progress status & added tests #3306
Conversation
|
WalkthroughThe changes introduce a new integration test suite for the Changes
Sequence Diagram(s)sequenceDiagram
participant UI as CollectionFlowUI
participant Service as CollectionFlowStateService
UI->>Service: handleSubmit()
alt Final submission not available
UI->>Service: setCollectionFlowStatus("inprogress")
end
Service->>Service: computeCurrentStatus(collectionFlowState)
Note right of Service: Returns appropriate status:<br/>edit, revision, inprogress, completed, etc.
Poem
Note ⚡️ AI Code Reviews for VS Code, Cursor, WindsurfCodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback. Note ⚡️ Faster reviews with cachingCodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure ✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
services/workflows-service/src/collection-flow/collection-flow-state.service.intg.test.ts (1)
114-129
: Verified inprogress status with idle steps.This test confirms another scenario for "inprogress" status - when some steps are completed and others are idle. Consider giving this test a more specific description to differentiate it from the first inprogress test.
Consider renaming this test to better differentiate it from the previous inprogress test:
- it('should return inprogress status', () => { + it('should return inprogress status when some steps are completed and others are idle', () => {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge Base: Disabled due to data retention organization setting
📒 Files selected for processing (3)
apps/kyb-app/src/pages/CollectionFlow/versions/v2/components/organisms/CollectionFlowUI/CollectionFlowUI.tsx
(2 hunks)services/workflows-service/src/collection-flow/collection-flow-state.service.intg.test.ts
(1 hunks)services/workflows-service/src/collection-flow/collection-flow-state.service.ts
(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
services/workflows-service/src/collection-flow/collection-flow-state.service.ts (3)
apps/backoffice-v2/src/domains/collection-flow/schemas.ts (1)
TCollectionFlowState
(18-18)packages/common/src/utils/collection-flow/enums/collection-flow-step-state-enum.ts (1)
CollectionFlowStepStatesEnum
(1-8)packages/common/src/utils/collection-flow/enums/collection-flow-status-enum.ts (1)
CollectionFlowStatusesEnum
(1-18)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Analyze (javascript)
- GitHub Check: test_linux
🔇 Additional comments (10)
apps/kyb-app/src/pages/CollectionFlow/versions/v2/components/organisms/CollectionFlowUI/CollectionFlowUI.tsx (2)
7-7
: Added necessary imports for new status handling logic.The additional imports support the new functionality for setting the collection flow status to "inprogress" during form submissions.
Also applies to: 10-10
199-200
: Good addition to explicitly set inprogress status.Setting the collection flow status to "inprogress" after updating step state and before context syncing ensures the status accurately reflects the partial completion state. This aligns with the updated
computeCurrentStatus
method in the service layer.services/workflows-service/src/collection-flow/collection-flow-state.service.ts (2)
227-227
: Correctly made computeCurrentStatus method public.Changing this method from private to public is appropriate as it's now needed by external components to determine the current status.
256-266
: Proper implementation of the inprogress status logic.The added code correctly identifies the "inprogress" status when at least one step is completed but not all steps are completed. This logic is placed appropriately in the status determination flow, after checking edit and revision states but before checking for completed status.
services/workflows-service/src/collection-flow/collection-flow-state.service.intg.test.ts (6)
1-50
: Well-structured test initialization.The test module is correctly set up with all necessary dependencies and proper mocking. The service is properly instantiated for the integration tests.
51-65
: Comprehensive testing for immutable statuses.The parametrized test case correctly verifies that immutable statuses (failed, rejected, approved) are returned unchanged by the computeCurrentStatus method.
67-80
: Verified inprogress status with completed and inProgress steps.Test validates that the status is correctly computed as "inprogress" when some steps are completed and others are in progress.
82-96
: Verified edit status precedence.Test confirms that edit status takes precedence over revision and inprogress scenarios when at least one step is in edit state, which is the expected behavior.
98-112
: Verified revision status precedence.Test confirms that revision status is correctly identified when at least one step is in revision state, without any edit steps present.
131-146
: Verified completed status.Test correctly validates that when all steps are in completed state, the status is computed as "completed".
…ing-data-collection
…ing-data-collection
Summary by CodeRabbit
New Features
Bug Fixes
Tests