Skip to content

Conversation

@AnujChhikara
Copy link
Contributor

@AnujChhikara AnujChhikara commented Jan 17, 2026

Date: 18 Jan, 2026

Developer Name: @AnujChhikara


Issue Ticket Number

Description

  • Added integration tests for submitting application feedback with various statuses (accepted, rejected, changes_requested).
  • Enhanced unit tests for the application feedback submission logic, covering success and error scenarios.
  • Updated application validator tests to ensure proper validation of feedback requirements based on status.
  • Included tests for handling empty feedback strings and ensuring feedback is appended correctly to existing records.

Documentation Updated?

  • Yes
  • No

Under Feature Flag

  • Yes
  • No

Database Changes

  • Yes
  • No

Breaking Changes

  • Yes
  • No

Development Tested?

  • Yes
  • No

Test Coverage

Screenshot 1 image image

@coderabbitai
Copy link

coderabbitai bot commented Jan 17, 2026

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This PR adds comprehensive test coverage for a new application feedback submission feature, including integration tests for the PATCH endpoint, unit tests for the controller and model methods, and expanded validator tests for status and feedback handling.

Changes

Cohort / File(s) Summary
Integration Tests
test/integration/application.test.ts
Adds 178 lines of integration tests for PATCH /applications/:applicationId/feedback covering successful submissions (rejected, changes_requested with/without feedback, accepted), validation errors (400 for changes_requested without feedback), and authorization/existence checks (401 for unauthorized/non-super user, 404 for missing application).
Unit Tests - Controller
test/unit/controllers/applications.test.ts
Consolidates nudgeApplication stub usage across tests (+138/-8) and introduces new submitApplicationFeedback test suite validating successful submissions, optional feedback handling, and error cases (notFound, badImplementation).
Unit Tests - Validator
test/unit/middlewares/application-validator.test.ts
Refactors to ES modules and shared test scaffolding (+118/-49); expands validateApplicationUpdateData tests for status values with/without optional feedback; adds validateApplicationQueryParam test coverage for allowed and disallowed query params.
Unit Tests - Model
test/unit/models/application.test.ts
Introduces comprehensive addApplicationFeedback test suite (+188 lines) validating success paths for all statuses, feedback text trimming, multiple feedback entries, notFound handling, and createdAt timestamp inclusion.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • Hariom01010
  • iamitprakash

Poem

🐰 Tests bloom like carrots in the spring so bright,
Feedback flows through systems, checked left and right,
Integration, unit, validator stacks aligned,
Every status, edge case, carefully designed,
Quality assured with each assertion's might! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: implementing comprehensive application feedback tests across integration and unit tests.
Description check ✅ Passed The description is well-related to the changeset, detailing the specific tests added for application feedback submission, validation, and error scenarios.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@AnujChhikara AnujChhikara self-assigned this Jan 18, 2026
@AnujChhikara AnujChhikara force-pushed the anuj/superuser-application-feedback branch from e57c612 to a02baf1 Compare January 18, 2026 15:42
@AnujChhikara AnujChhikara force-pushed the anuj/applications-feedback-tests branch from ba49b5b to 79721d9 Compare January 19, 2026 18:00
MayankBansal12
MayankBansal12 previously approved these changes Jan 19, 2026
@AnujChhikara AnujChhikara changed the title feat: implement comprehensive application feedback tests test: implement comprehensive application feedback tests Jan 19, 2026
iamitprakash
iamitprakash previously approved these changes Jan 20, 2026
Base automatically changed from anuj/superuser-application-feedback to develop January 20, 2026 19:02
@iamitprakash iamitprakash dismissed stale reviews from MayankBansal12 and themself January 20, 2026 19:02

The base branch was changed.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@test/integration/application.test.ts`:
- Around line 597-615: Remove the duplicate "should return 401 if user is not a
super user" test block in test/integration/application.test.ts (the one that
calls .patch(`/applications/${applicationId1}/feedback`) and uses
cookieName/jwt) so only the original test remains; locate the duplicate by the
test description string and delete that entire it(...) block to avoid redundant
coverage while leaving the earlier identical test (the original at the other
location) intact.

In `@test/unit/middlewares/application-validator.test.ts`:
- Around line 2-3: Remove the unnecessary alias by deleting the `const Sinon =
sinon;` declaration and use the imported `sinon` object directly; update all
occurrences of `Sinon.spy()` (and any other `Sinon.*` usages) to `sinon.spy()`
(or corresponding `sinon.*`) so the tests use the original import consistently.

@iamitprakash iamitprakash merged commit ee2825f into develop Jan 21, 2026
4 of 5 checks passed
@iamitprakash iamitprakash deleted the anuj/applications-feedback-tests branch January 21, 2026 18:08
@AnujChhikara AnujChhikara mentioned this pull request Jan 21, 2026
10 tasks
iamitprakash added a commit that referenced this pull request Jan 21, 2026
* feat: add application feedback submission functionality (#2552)

* test: implement comprehensive application feedback tests (#2555)

* feat: add application feedback submission functionality

* feat: enhance application feedback functionality with comprehensive tests

* refactor: update application validator tests for improved clarity and consistency

* test: remove unauthorized user test case for application feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants