Skip to content

Linh - Added unit test for popupEditorController#1527

Merged
one-community merged 3 commits intodevelopmentfrom
linh_unitTest_popupEditorController
Feb 24, 2026
Merged

Linh - Added unit test for popupEditorController#1527
one-community merged 3 commits intodevelopmentfrom
linh_unitTest_popupEditorController

Conversation

@linh2020
Copy link
Contributor

@linh2020 linh2020 commented Jul 10, 2025

Description

This PR adds full unit test coverage for the popupEditorController in the backend, ensuring its core functionalities are properly validated. Tests include success and failure paths, permissions handling, and input validation.

Related PRS (if any):

No related PRs

Main changes explained:

  1. Added 15 Jest unit test cases covering:
  • getAllPopupEditors – success and error handling
  • getPopupEditorById – success and failure scenarios
  • createPopupEditor – with/without permissions, missing fields, save errors
  • updatePopupEditor – with/without permissions, invalid/missing content, save errors
  1. Updated popupEditorController.js:
  • Improved error handling in updatePopupEditor to catch null or undefined popup objects
  • Added error catch block if findById returns no result

How to test:

  1. Check out this branch locally.
  2. Run npm install if needed.
  3. Run the test suite: npm test src/controllers/popupEditorController.spec.js
  4. Ensure all 15 test cases pass.

Screenshots or videos of changes:

2025-07-09 20_15_59-popupEditorController spec js - HGN-application (Workspace) - Visual Studio Code
creenshots or videos of changes:

Note:

  • This PR ensures full backend test coverage for the popup editor controller.
  • The logic was enhanced for better error clarity.
  • Please review and approve so the team can confidently build on top of this controller.

Copy link
Contributor

@abdel-lall abdel-lall left a comment

Choose a reason for hiding this comment

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

LGTM!
Screenshot 2025-07-12 110554

Copy link
Contributor

@ManviKishore ManviKishore left a comment

Choose a reason for hiding this comment

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

All test cases are passing successfully.

Screenshot 2025-08-02 211910

Copy link
Contributor

@linkhanthtel linkhanthtel left a comment

Choose a reason for hiding this comment

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

All test cases passed as expected. Nice work!

PR #1527

@one-community one-community added the High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible label Feb 22, 2026
Copy link

@Anusha-Gali Anusha-Gali left a comment

Choose a reason for hiding this comment

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

Hi Linh,

I have reviewed your PR locally and it all the test case pass as per requirement.
Image

Note: Code still points to old Db.js,

Copy link

@HemanthNidamanuru HemanthNidamanuru left a comment

Choose a reason for hiding this comment

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

Hi Linh,

I checked out this branch locally and verified the changes. All tests are passing successfully.

Image

@sonarqubecloud
Copy link

@one-community
Copy link
Member

Thank you all, merging!

@one-community one-community merged commit 1b390f9 into development Feb 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

High Priority - Please Review First This is an important PR we'd like to get merged as soon as possible

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants