feat: tests for OOO acknowledgement feature#2474
feat: tests for OOO acknowledgement feature#2474iamitprakash merged 24 commits intofeature/ooo-req-acknowledgementfrom
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Summary by CodeRabbit
WalkthroughAdds OOO request acknowledgment flow: constants expanded; new controller, middleware, validator, and service methods; route updated to include conditional dev/role checks; models gain get-by-id; existing controllers/validators updated to route OOO acknowledgments; types added; tests adjusted to new names, signatures, and behaviors. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant C as Client
participant R as Router
participant MW1 as authenticate
participant MW2 as conditionalOooChecks
participant MW3 as updateRequestValidator
participant CTRL as updateRequestBeforeAcknowledgedController
participant OOOCTRL as acknowledgeOooRequest (controller)
participant SRV as oooRequest Service
participant M as Models
participant L as Log Service
C->>R: PATCH /requests/:id (body: {type: OOO, status, comment})
R->>MW1: authenticate
MW1-->>R: next()
R->>MW2: conditionalOooChecks
alt type == OOO
MW2->>MW2: devFlagMiddleware
MW2->>MW2: authorizeRoles([SUPERUSER])
else
MW2-->>R: next()
end
R->>MW3: updateRequestValidator
MW3-->>R: next()
R->>CTRL: updateRequestBeforeAcknowledgedController(req,res,next)
alt REQUEST_TYPE == OOO
CTRL->>OOOCTRL: delegate(req,res,next)
OOOCTRL->>SRV: acknowledgeOooRequest(requestId, body, superUserId)
SRV->>M: getRequestById
M-->>SRV: request or NotFound
SRV->>SRV: validateOooAcknowledgeRequest(type,status)
SRV->>M: update request status
SRV->>L: addLog(REQUEST_APPROVED/REJECTED)
opt on approval
SRV->>M: createFutureStatus + createUserFutureStatus
end
SRV-->>OOOCTRL: {data, message}
OOOCTRL-->>C: 200 {data, message}
else
CTRL-->>C: existing non-OOO flow
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches🧪 Generate unit tests
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. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
Review by Korbit AIKorbit automatically attempts to detect when you fix issues in new commits.
Files scanned
|
AnujChhikara
left a comment
There was a problem hiding this comment.
@RishiChaubey31 don't find any test for user status changed , if super user approve the request then the user status must changed based on their request, can you please add them
…l-Dev-Squad/website-backend into test/ooo-req-acknowledgement
Date: 27-08-2025
Developer Name: Rishi Chaubey
Description
Issue Ticket
Documentation Updated?
Under Feature Flag
Database Changes
Breaking Changes
Development Tested?
Screenshots
Screenshot 1
Test Coverage
Screenshot 1
Additional Notes
Description by Korbit AI
What change is being made?
Add comprehensive tests for the OOO (Out-Of-Office) acknowledgement feature, including unit tests, integration tests, and refactored test fixtures, while updating references throughout the test files.
Why are these changes being made?
The changes improve the test coverage for the OOO feature, ensuring that both happy and edge cases, including invalid request types and unauthorized actions, are thoroughly tested. The refactoring also maintains the consistency and readability of the codebase by updating function names and comments.