Skip to content
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

Vijay Anand - Added unit test owner message action #3126

Open
wants to merge 3 commits into
base: development
Choose a base branch
from

Conversation

vijay10pk
Copy link
Contributor

Description

Added unit tests for the ownerMessage action creators.

Related PRS (if any):

No related PRs.

Main changes explained:

  • getOwnerMessage: Verified that the action correctly fetches and dispatches the owner message data on successful API calls and gracefully handles error responses without dispatching unnecessary actions.
  • updateOwnerMessage: Confirmed that the action updates the owner message, dispatches the correct payload after a successful API call, and properly handles failure scenarios by returning appropriate error messages.
  • deleteOwnerMessage: Ensured that the action deletes the owner message, dispatches an empty payload upon successful deletion, and handles errors effectively without unexpected dispatches.
  • updateOwnerMessageAction: Validated that the action creator returns the correct action type and payload structure.
  • Mocked Axios to simulate API interactions in a controlled test environment.
  • Ensured no unnecessary console logs or errors during test execution by mocking and restoring console methods.

How to test:

  1. Check out the branch.
  2. Run npm install if dependencies have been updated.
  3. Execute npm test ownerMessageActions.test.js.
  4. Confirm all tests pass without errors.

Screenshots or videos of changes:

Screenshot 2025-02-06 at 12 00 59 PM

Note:

Include the information the reviewers need to know.

Copy link

netlify bot commented Feb 7, 2025

Deploy Preview for highestgoodnetwork-dev ready!

Name Link
🔨 Latest commit fdfdb36
🔍 Latest deploy log https://app.netlify.com/sites/highestgoodnetwork-dev/deploys/67a57a46e587310008d93cce
😎 Deploy Preview https://deploy-preview-3126--highestgoodnetwork-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@lalith425
Copy link

Checked the test case and went through the file. Everything is working as expected:
UnitTestingOwnerMessageActionpng

Copy link

@fangedShadow fangedShadow 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 ran successfully, PR Test works fine.
image_2025-02-07_121650168

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.

3 participants